On snippetclub.com, I use a table of contents in the sidebar. However, on some older posts, I don’t have any headings on the page. This causes a blank space to be rendered. I wanted a way to hide the whole table of contents container if I don’t have any headings.
1.The code
Add the code below into your functions.php
or code snippet plugin.