Q5-TOC is a WordPress plugin to provide stylized Table of Contents functionality. The plugin provides for a T.o.C. on both Posts and Pages up to a depth of 6, and provides for Parent and Child links on Pages and Peer Blogs on Posts.

If you are here because you are, or have used the plugin, then please accept our thanks.


Provides a Table of Contents up to a depth of 6 levels. For Pages it will present a link to the Parent page if there is one, and links to any child pages. For Posts it will provide links to any Peer posts, where a Peer post is deemed to be any published post with a common category

The TOC is also fixed. i.e. it does not scroll when the page is scrolled.

Options are provided to:

  1. Set the required depth.
  2. Set the HTML elements to use as the TOC elements
  3. Set the header text for TOC, and Parent, Peer and Child page links.
  4. Exclude Cateogries from the Peer Blog group



The plugin allows for a ToC up to 6 levels in depth, with the default being 3.

HTML Header elements

It also provides facilities for defining the HTML elements that will be recognised as the ToC headers. By defalut these are H1 – H6, but you can set them to whatever you need, with the proviso that a HTML element must only be used for a single level.

The plugin will check that the names used for the HTML elements are well formed, (i.e. conform to the HTML convention for element names.) but, of course, it cannot know whether the names are actual HTML elements.

Options menu

The Options menu for Q5_TOC is located in the Settings Admin menu

Settings Menu
Settings Menu

which will display the Options page

WordPress Compatibility

  • WordPress 5.2 and above
  • PHP 7.2 and above

Known issues:

We currently have the following known issues:

Invalid HTML

The TOC uses the php DOMDocument library to parse the post/page for the HTML T.o.C. elements. The DOMDocument library may fail to load the post/page if it is incorrectly formed. (i.e. If there are missing or incorretly nested HTML elements). If this is the case a message will be displayed and the TOC will not be generated.

The only solution is to fix the HTML. A possible route to determining the issue would be to examine the source. Most browsers will highlight, in red, any badly nested HTML elements.

Leave a Reply