From e4e81ef81c71556e4a743b48ccaa87eec65b31fb Mon Sep 17 00:00:00 2001 From: Nonimart Date: Mon, 23 Jun 2025 16:43:27 +0200 Subject: [PATCH] TEST trying to fix problem with id attributes for links --- includes/utilities.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/includes/utilities.php b/includes/utilities.php index 698d7a8..7e2333d 100644 --- a/includes/utilities.php +++ b/includes/utilities.php @@ -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')); } }