Would you like to learn how to exclude comments from the Table of Contents ofElementor ?

Elementor has a default widget called Table Of Contents which you can use to add additional navigation functionality to your Website. With this widget you don't need to install any additional plugin just to add or create a table of contents on your website WordPress. The Table Of Content widget itself can be used anywhere on your Website, including on blog posts.

If you want to add a table of contents for each blog post using the Table Of Content widget fromElementor, you can create a custom template for the item usingElementor Theme Builder.

The operation of the Table Of Content widget is quite similar to that of other table of contents plugins, where it generates the table of contents list items. If you are using this widget on a custom single post template, chances are the comments section will be included in the listing. How to exclude it?

The Table Of Content widget allows you to exclude list items by CSS selector. Therefore, you need to determine the CSS selector for the comments section on the theme that you are using. In most cases, you can find it in the file comments.php of your WordPress theme. To access this file, you can go to Appearance -> Theme editor on your WordPress dashboard. Select comments.php in the right panel.

exclude comments from the Table of Contents widget
exclude comments

With the file selected, find the CSS selector in the editor area. In our case, the selector in the comments section is as shown in the screenshot below.comments-area

Then go to the Elementor editor and edit the Table Of Content widget. In the block Table Of Contents under the tab Content, click on the EXCLUDE tab and paste the CSS selector you found above into the field Anchors By Selector. Add a period as a prefix.

exclude comments from the Table of Contents widget


If you want to exclude other sections, you can just add the CSS selector of the sections you want to exclude in the field Anchors By Selector. You can separate each CSS selector with a comma.

Get Elementor Pro Now!!!

Conclusion

There ! That's it for this article that shows you how to exclude comments from the Table of Contents widget. If you have any concerns on how to get there flet us know in the Comments.

However, you can also consult our resources, if you need more elements to carry out your projects of creation of Internet sites, by consulting our guide on the WordPress blog creation or the one on Divi: the best WordPress theme of all time.

But meanwhile, share this article on your different social networks.

...