• Hey there,

    if I use the auto-insert(page) function it works everywhere…
    but if I want to use the shortcode [joli-toc] in my avada website on the exact same place like the auto-insert function would use nothing happens.

    The # links are added to my headings but the Toc is missing.
    The same happened on another system with wpbakery.
    I tried it on the linked page and on https://experts4energy.com/plug-and-play-solaranlage/.
    There it did work with a shortcode.
    Why is my Toc missing on the page when it actually works?

    Thank you!

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author WPJoli

    (@wpjoli)

    Hi,

    I believe the wpbakery builder uses shortcodes behind the scenes to render heaadings.

    It turns out for the Joli TOC shortcode rendering, at some point the page content is processed before shortcodes rendering. The logic is a bit complex and I’m sure it can be improved but in the mean time, can you try the following and let me know if it works ?

    Add this to your theme’s functions.php :

    
    add_filter('joli_toc_post_content_preprocessing', function($content){
    	$content = str_replace(apply_filters('jolitoc_shortcode_tag', JTOC()::DOMAIN), '', $content);
    	return apply_filters('the_content', $content);
    });

    Thanks!

    Thread Starter seowerk

    (@seowerk)

    Hey,

    thanks for the code. It works now on WPBakery.
    https://bornak.de/flutter-zukunft-app-entwicklung/#app-entwicklung-mit-dem-cross-plattform-framework-flutter

    Unfortunately the Ids are not added to the headings so the table of content doesnt scroll to the heading.
    Maybe my theme is overwriting the Joli class?

    Also, I tried the same filter on my avada site but there my page is not loading correctly. https://experts4energy.com/wallbox-foerderung/

    Do you have an Idea for my avada site as well?

    Thanks again!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Toc doesnt show with Shortcode’ is closed to new replies.