A powerful yet user friendly plugin that automatically creates a context specific index or table of contents (TOC) for long pages (and custom post types). More than just a table of contents plugin, this plugin can also output a sitemap listing pages and/or categories across your entire site.
- 1 Description
- 2 Translations
- 3 Screenshots
- 4 Scenarios / FAQs
- 4.1 The simplest approach
- 4.2 How do I disable the table of contents for a certain page?
- 4.3 My site has 100 pages but I only want the table of contents to appear on 10 of them
- 4.4 I want to ignore certain headings
- 4.5 Can I have the table of contents in the sidebar?
- 4.6 Unlike Wikipedia, I want all my anchors to be lowercase and use hyphens rather than underscores
- 4.7 I would like to incorporate a sitemap
- 5 Install / upgrade
- 6 Shortcodes
- 7 Versioning scheme
- 8 I love it, how can I show my appreciation?
- 9 Questions or suggestions?
Built from the ground up and with Wikipedia in mind, the table of contents by default appears before the first heading on a page. This allows the author to insert lead-in content that may summarise or introduce the rest of the page. It also uses a unique numbering scheme that doesn’t get lost through CSS differences across themes.
This plugin is a great companion for content rich sites such as content management system oriented configurations. That said, bloggers also have the same benefits when writing long structured articles. Discover how Google uses this index to provide ‘Jump To’ links to your content.
Includes an administration options panel where you can customise settings like display position, define the minimum number of headings before an index is displayed, other appearance, and more. For power users, expand the advanced options to further tweak its behaviour – eg: exclude undesired heading levels like h5 and h6 from being included; disable the output of the included CSS file; adjust the top offset and more. Using shortcodes, you can override default behaviour such as special exclusions on a specific page or even to hide the table of contents altogether.
Prefer to include the index in the sidebar? Go to Appearance > Widgets and drag the TOC+ to your desired sidebar and position.
Custom post types are supported, however, auto insertion works only when
the_content() has been used by the custom post type. Each post type will appear in the options panel, so enable the ones you want.
- Australian English (default)
- Dutch – Renee
- French – Jean-Michel Duriez
- Polish – Jakub
- Simplified Chinese – icedream
- Slovak – Boris Gereg
- Ukrainian – Michael Yunat
Translations are more than welcome. The translation file can be found in the languages folder of the plugin, or online in the WordPress repository.
If you have any advice in making it easier to translate, please let me know.
Scenarios / FAQs
The simplest approach
For the impatient, all you have to do is enable the plugin.
The plugin will apply default settings and produce the table of contents before the first heading on pages (not posts, nor custom post types) with four or more headings.
No shortcodes needed.
How do I disable the table of contents for a certain page?
[no_toc] anywhere on the page to suppress the table of contents.
My site has 100 pages but I only want the table of contents to appear on 10 of them
You could put
[no_toc] on the 90 pages but that wouldn’t be fun… so try the following:
- Go to Settings > TOC+ and disable the auto insertion option for pages (or the content type you’re working with).
[toc]onto the 10 pages that need them. Note that the table of contents will appear where you placed the shortcode.
Alternatively, you could also experiment with the restrict path option if the pages you want to include the index on all fall within a certain section of your site (eg /wiki/).
I want to ignore certain headings
Use the ‘exclude headings’ option if you would like to ignore certain headings. Separate multiple headings with a pipe
|. Use an asterisk
* as a wildcard to match other text. Note that this is not case sensitive. Some examples:
Fruit*ignore headings starting with Fruit
*Fruit Diet*ignore headings with Fruit Diet somewhere in the heading
Apple Tree|Oranges|Yellow Bananasignore headings that are exactly Apple Tree, Oranges or Yellow Bananas
Use the TOC+ widget and drag it into your desired position. If you want the table of contents to only be displayed in the sidebar, then make sure you tick that option in the widget.
Unlike Wikipedia, I want all my anchors to be lowercase and use hyphens rather than underscores
There are two options that allow you to adjust the casing and use of hyphens. If you still require more, you can massage it a little more by attaching into the
toc_url_anchor_target filter. See the developer help section for an example.
I would like to incorporate a sitemap
- Create a page for your sitemap (if you have an existing one, use that instead).
[sitemap]into your page and save.
The above is the simplest example of integrating a sitemap listing all pages and categories. You can customise the sitemap options under Settings > TOC+ or check out some of the more advanced uses with the sitemap related shortcodes below.
You could also incorporate a sitemap using a text widget and pasting any of the sitemap shortcodes.
Install / upgrade
Install the plugin by searching for Table of Contents Plus from the plugin add menu, or directly from the WordPress plugins repository.
There are no special upgrade instructions (woohoo!). Overwrite your existing folder with the latest or use the streamlined approach in the plugin menu. Your options will not be lost.
The plugin was designed to be as seamless and painfree as possible and did not require you to insert a shortcode for operation. However, using the shortcode allows you to fully control the position of the table of contents within your page. The following shortcodes are available with this plugin.
When parameters are left out for the shortcodes below, they will fallback to the settings you defined under Settings > TOC+.
Lets you generate the table of contents at the preferred position. Also useful for sites that only require a TOC on a small handful of pages.
- label: text, title of the table of contents
- no_label: true/false, shows or hides the title
- wrapping: text, either “left” or “right”
- heading_levels: numbers, this lets you select the heading levels you want included in the table of contents. Separate multiple levels with a comma. Example: include headings 3, 4 and 5 but exclude the others with
- exclude: text, enter headings to be excluded. Separate multiple headings with a pipe |. Use an asterisk * as a wildcard to match other text. You could also use regular expressions for more advanced matching.
Allows you to disable the table of contents for the current post, page, or custom post type.
Produces a listing of all pages and categories for your site. You can use this on any post, page or even in a text widget.
Lets you print out a listing of only pages. The following parameters are accepted:
- heading: number between 1 and 6, defines which html heading to use
- label: text, title of the list
- no_label: true/false, shows or hides the list heading
- exclude: IDs of the pages or categories you wish to exclude
- exclude_tree: ID of the page or category you wish to exclude including its all descendants
Similar to [sitemap_pages] but for categories.
This lets you print out an index of all published posts on your site. By default, posts are listed in alphabetical order grouped by their first letters. There are CSS classes for each section, letter and list allowing you to customise the appearance.The following parameters are accepted:
- order: text, either ASC or DESC
- orderby: text, popular options include “title”, “date”, “ID”, and “rand”. See WP_Query for a list
- separate: true/false, when set to false, does not split the posts by first letter.
I have adopted the same Ubuntu versioning scheme so the first release is 1107.
Other releases in the same month will be dot releases, eg the second release in July 2011 is 1107.1.
I love it, how can I show my appreciation?
If you have been impressed with this plugin and would like to somehow show some appreciation, rather than send a donation my way, please donate to your charity of choice. Feel free to leave a short note here if you’d like.
I will never ask for any form of reward or compensation. Helping others achieve their goals is satisfying enough
Questions or suggestions?
If you have questions or suggestions, please place them below.