April 6, 2022 at 11:09 pm #1347488
Hope you are doing great. This is an improvement suggestion.
When creating a Table of Content Widget, the Widget Title is an H3. Therefore, if you only choose to display the H2s, there is no problem. But if you choose to display the H3s, the Widget Title is included on the Table of Content list.
It would be great if you could somehow make sure the Widget Title that contains the TOC would not be included on the Table of Contents itself.
HaviApril 8, 2022 at 10:20 pm #1347752
Thank you for your suggestion, but I don’t seem to be able to reproduce this.
I tested on a Classic Editor and Advanced Layout Builder post with H3 headings and the TOC doesn’t include it’s own heading:
I included links to my test posts below, using v220.127.116.11 with only WooCommerce as a plugin.
MikeApril 8, 2022 at 11:34 pm #1347756
Try it on the Block Editor inside of a Blog Post. That’s where I noticed it.
(And I usually don’t choose to show the H3s but more complex articles, sometimes call for it)
HaviApril 9, 2022 at 12:07 am #1347759
I tried using the block editor for the post but the TOC still didn’t show it’s H3 title, is your TOC in the sidebar?
I don’t see a way to add a widget in the block editor on a post.
If I create a Advanced Layout Builder post and use H3 headings and add a widget element instead for using a sidebar the TOC does show it’s title:
Is this what you did?
MikeApril 9, 2022 at 12:44 am #1347762
No. But that’s interesting.
Here’s how I do it:
I create a Widget on the WordPress Admin with the TOC selecting both H2 and H3.
Then on the Block editor I add a Shortccode Block, and inside I add the Enfold Shortcode [av_sidebar widget_area='TOCWidget' av_uid='av-h6k48'] I sent you a link to how it looks with H2s only in the Private content.
But if you change the WordPress Widget to select H3s, it will pick up the Widget Title.
And yes, the Block Editor has useless dual background blocks but no way to add a WordPress Widget. I wish I would have stayed with the Classic Editor for this site but I decided to go with the flow.
HaviApril 9, 2022 at 1:59 pm #1347780
Thanks for the feedback, I was able to reproduce this following your description and I was able to solve it by using the Exclude headlines by class field which the Dev Team included in the widget:
By using the widget title class widgettitle it is excluded from the TOC, I would recommend this for your case rather than limiting the function for all users.
I hope that you find using the Exclude headlines by class field a good solution for your project.
MikeApril 9, 2022 at 7:19 pm #1347807
So, this class already exist in the theme? All I have to do is add it to the Widget?
Wow! Never mind! It worked like a charm! Thank you so much!!! Maybe this can also help others in my same situation. :) It is a very easy way to address it.
April 9, 2022 at 7:48 pm #1347813
- This reply was modified 1 year, 7 months ago by havi.
- The topic ‘Table of Content Widget and H3’ is closed to new replies.