TEST trying to fix problem with id attributes for links
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
ae8f5c6b5e
commit
e4e81ef81c
|
|
@ -110,8 +110,10 @@ add_filter('the_content', 'apply_footnotes_urls_to_content', 10);
|
|||
function apply_footnotes_urls_to_content($content)
|
||||
{
|
||||
$post_type = get_post_type();
|
||||
|
||||
if ($post_type !== 'articles' && !is_admin()) return $content;
|
||||
|
||||
|
||||
$footnotes = build_footnotes_index_from_content($content);
|
||||
$dom = new DOMDocument();
|
||||
@$dom->loadHTML(mb_convert_encoding($content, 'HTML-ENTITIES', 'UTF-8'), LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
|
||||
|
|
@ -120,6 +122,7 @@ function apply_footnotes_urls_to_content($content)
|
|||
foreach ($links as $key => $link) {
|
||||
if ($link->hasAttribute('class') && strpos($link->getAttribute('class'), 'footnote-reference') !== false) {
|
||||
$link->setAttribute('id', 'footnote-' . $key + 1);
|
||||
write_log($link->getAttribute('id'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user