• Hi, I like to change the TOC title, Table of Content( I think now in my website that it shows as bold) into h2 or h3 or h4? How do you do that?

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author LuckyWP

    (@theluckywp)

    Hello!

    Headings in your post when showed ToC displayd as bold?

    Show page url.

    Thread Starter Manny

    (@thewebnerd)

    Yes here is the link https://www.thehowandwhatwebhostingnerd.com/fix-a-slow-loading-website/

    • This reply was modified 4 years, 6 months ago by Manny.
    Plugin Author LuckyWP

    (@theluckywp)

    I don’t understand problem. Can you describe it in more detail?

    Thread Starter Manny

    (@thewebnerd)

    Like I said earlier I am talking about the title “Table Of Content”. When you inspect the title “Table of Content” it is in bold instead of html header tag like h2,h3, or h4. So we like to make that title “Table of Content” a html tag. Any code or recommendation on how to do that?

    Plugin Author LuckyWP

    (@theluckywp)

    This unavailable yet.

    In next version we will add new hook filter lwptoc_title_tag and you can use this code:
    add_filter('lwptoc_title_tag', function() { return 'h2'; });

    Thread Starter Manny

    (@thewebnerd)

    Thank you. So any idea when that next update will be? Also,for that code that you said that I can use for now, where do you put it? Function.php?

    Plugin Author LuckyWP

    (@theluckywp)

    We released new version 2.1.2 just now.

    Yes, add this code to functions.php in your theme.

    Thread Starter Manny

    (@thewebnerd)

    Ok I am a little confused. I updated the plugin now and I still don’t see the option to pick the title as an HTML header tag.

    So after updating the plugin I have to add this add_filter(‘lwptoc_title_tag’, function() { return ‘h2’; }); in the fucntion.php? Or was that meant for before the update?

    Plugin Author LuckyWP

    (@theluckywp)

    Yes.

    In old version don’t have hook lwptoc_title_tag and this code don’t work.

    Now you should add code add_filter('lwptoc_title_tag', function() { return 'h2'; }); to functions.php.

    Thread Starter Manny

    (@thewebnerd)

    Is there a way to make it so that each page Html header tag is different? The code you gave me seems to only make it one header tag for all pages.

    • This reply was modified 4 years, 6 months ago by Manny.
    Plugin Author LuckyWP

    (@theluckywp)

    You can use conditions. For example:

    add_filter('lwptoc_title_tag', function() {
    	if (is_page()) {
    		return 'h2';
    	} else {
    		return 'h3';
    	}
    });
Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘TOC Title into H2’ is closed to new replies.