Aug 312014
Article WordPress

A table of contents (ToC) can improve substantially the appearance and usability of a web page. This is also true for blog entries, if the size and structure of the page makes it suitable.

This post explains how to include a ToC in a blog post or page of a web site that runs the popular WordPress CMS.


Structuring the page in sections and subsections at various levels

Adding a Table of Contents to a page is specially interesting if the volume of information in the page is big enough.

In this case, it is advisable to structure hierarchically the content in chapters, sections, subsections, etc.

Usually, each of these elements has a heading with a title in it. In HTML, elements <h1> to <h6> can be used to identify these headings up to six levels depth.

Manual insertion of a table of contents

Our previous, more generic post on “How to add a table of contents to a web page” explains the procedure to create manually a ToC, inserting the HTML code of the anchors and links that are used to build the ToC.

This option is always available for those that whish to use it. However, if the web site is running a content management system such as WordPress, it is much easier to use a plugin that implements the desired functionality, to enable the insertion of a ToC without having to edit the HTML code of the page.

The Table of Contents Plus WordPress plugin

In WordPress, it is not easy to find a functionality for which a plugin has not already been developed. This is also the case of the functionality to add a table of contents to a blog post or page.

Actually, searching for “Table of Contents” in the  WordPress plugin directory returns a high number of matches. Among them, we have chosen “Table of Contents Plus“. This plugin features a fair number of configuration options, making it well suited for most typical cases.

Installing and configuring TOC+

TOC+ installation is done in the same way as in most WordPress plugins, selecting “Plugins > Add new” from the left menu in the administration panel, or else downloading the installation package and uncompressing it under the wp-content/plugins subdirectory.

Once installed and configured, the configuration options can be accessed selecting “Settings > TOC+”:




The configuration options in this screen can be tuned to modify the behaviour of the plugin

  • Automatically insert a ToC in the selected types of page
  • Only insert the ToC when there are a minimum number of hierarchical levels in the page  (defaults to four levels)
  • Inserting manually the ToC using shortcode
  • Prevent the insertion of a ToC using shortcode
  • Several options to customize the style used to display the table of contents

In the sample image above, the automatic insertion of the ToC has been disabled of all types of page. With that configuration, the shortcode  needs to be explicitly inserted to add a ToC to a post or page ( using the shortcode also allows us to place the ToC where we want it to appear). After adding the shortcode, the resulting ToC is displayed as can be seen at the top of this same post.

 Posted by at 8:07 pm

 Leave a Reply