• Resolved ocaso

    (@ocaso)


    Hi, I have a website teaching HTML. Where, if the title contains HTML tag, the TOC does not display properly. It simply omits the HTML tag.

    I attach two images.

    TOC: https://ibb.co/88sCsKC

    Original h2: https://ibb.co/hyHbdLL

    Can you help me to get the display right?

    Thank you!

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author WPJoli

    (@wpjoli)

    Hi,

    Thank you for reporting this. It is actually a small bug and I can only ask you to wait for a few days until I bring a fix to this.

    In the meantime, you can actually use one of our built-in filters if you need fixed now. Paste this in your theme’s functions.php and remove it after the next update because it will become unnecessary.

    add_filter('joli_toc_headings', 'filter_headings', 10, 2);
    // Escape HTML for headings
    function filter_headings($headings)
    {
        if (version_compare(JTOC()::VERSION, '2.0.5', '<=')) {
            $headings = array_map(function ($heading) {
    
                $heading['title'] = esc_html($heading['title']);
    
                return $heading;
            }, $headings);
        }
        return $headings;
    }
    

    Let me know if this works.

Viewing 1 replies (of 1 total)
  • The topic ‘If the title contains HTML tag, the TOC does not display properly’ is closed to new replies.