Table of Contents Plus

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.

Description

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.

Translations

  • Australian English (default)
  • Dutch – Renee
  • French – Jean-Michel Duriez
  • German – Ben
  • 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.

Screenshots

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?

Simply add [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:

  1. Go to Settings > TOC+ and disable the auto insertion option for pages (or the content type you’re working with).
  2. Add [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 Bananas ignore headings that are exactly Apple Tree, Oranges or Yellow Bananas

Can I have the table of contents in the sidebar?

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

  1. Create a page for your sitemap (if you have an existing one, use that instead).
  2. Add [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.

Shortcodes

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+.

[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 heading_levels="3,4,5"
  • 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.
  • class: text, enter CSS classes to be added to the container. Separate multiple classes with a space.

[no_toc]

Allows you to disable the table of contents for the current post, page, or custom post type.

[sitemap]

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.

[sitemap_pages]

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

[sitemap_categories]

Similar to [sitemap_pages] but for categories.

[sitemap_posts]

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.

Versioning scheme

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.

799 thoughts on “Table of Contents Plus”

  1. We are building a series of learning modules for our WP website, where each module will be a singe WP page. There will be lots of content, and your wikipedia approach is exactly what we’re looking for. I’m wondering, though, and being the content director and not the techie directer, is your plugin something that we can easily turn on/off from our pages. In other words, every page on our website EXCEPT the module pages will not have tables of content, and I need to make sure that if we go with yours, we have the option of turning it on/off. If you get the chance to reply, I’d really appreciate it.

    1. Hi Regan

      At present, you can tell it to auto insert the table of contents on all pages but on pages where you don’t want them to appear, you can place the [no_toc] shortcode anywhere within the page’s content to disable the table of contents generation for that page. This would ideal for sites that have a small handful of pages that don’t need the index.

      Another option to apply would be to increase the number of headings needed before the table of contents is displayed. If you find that your learning modules have say 6 or more headings and the rest of your normal pages has less, then try setting that option to 6 in the options page (Settings > TOC+).

      I imagine the [no_toc] approach would be an ideal solution for you.

      I am working towards an inverse approach eg having the index disabled by default and only displaying it if you have something like [TOC] in your content. This would be ideal sites that only need the table of contents on a small handful of pages.

      Hope that helps.

      1. Hey, thanks for the reply. The plugin looks really slick and the inverse approach is exactly what we’re looking for (i.e. with the exception of roughly 10 pages, no other ones will have toc). I’ll keep a lookout for that release.

        Cheers,
        Regan.

        p.s. this font is great! what is it?

      2. According to CSS declaration for it, the font is most likely Helvetica Neue:

        “Helvetica Neue”,Helvetica,Arial,sans-serif

        It’s the default one for the new Twenty Eleven theme which came with WordPress 3.2

      3. Hi, love your table of content plugin however, I’m looking at pages with long article page to have the table of content box scroll along with #content to the exact location. For instance, I clicked on one of the headings on the TOC box and it scroll/jump to that page but the TOC is out of nowhere and if the article is a long one, you sure people wont want to start scrolling up to click the next title. Something that works like widget the move down along the side. Hope you catch my drift? Thanks for all the care.

  2. I have been looking for an easy to use TOC. I came across yours. Unfortuneatly, I cannot get it to work. I am uncertain as to why this is. I made a test post and the TOC appeared once. When the page was refreshed, it disappeared and I do not know how to get it back. It has never appeared on any page made previous to the installation of this plugin.

    Any suggestions?

    Thanks.

    1. Hi Stacey

      Do you have more than 4 headings on the post/page? It doesn’t count heading 1 as that should be your content title or site title.
      By default, it does pages so if you want it to appear on posts, you need to enable it in Settings > TOC+ 

      Do you get any errors? If you’re still having issues, can you provide a link?

    1. Hi Imran

      Thanks for linking to your amendments. I’ll take a look next time I’m on a desktop as the mobile version of the link keeps redirecting me elsewhere.

      I actually had planned to incorporate back to top links but didn’t for this first release as wikipedia didn’t either.

    2. Hey Imran,

      Your “back to top” functionality is a great addition, but I’m having some issues with IE (of course). You can see this issue if you open up your sample page in IE: http://mini.cselian.com/info/ozone/medical-use
      (I’m using IE8)

      The title and ul are getting split into different divs and both getting the #toc_container attributes (floats, borders, ect.) added to them, creating two boxes and a fubar-ed layout (if you are text-wrapping, floating).

      I tried just disable the TOC, then re-add it with a shortcode, which I would then wrap in a div that I could style, but your amended php file does not have the [toc] shortcode, and I’m having trouble adding it in successfully.

      I’m wondering if either of you fine developers could think of a solution for this issue? I’d love to be able to use this plugin, but unless it’s resolved, I’ll be on the hunt for a new one :(

      Thanks,
      Gabrielle

    3. Hey Imran,

      Your “back to top” functionality is a great addition, but I’m having some issues with IE (of course). You can see this issue if you open up your sample page in IE: http://mini.cselian.com/info/ozone/medical-use

      The title and ul are getting split into different divs and both getting the #toc_container attributes (floats, borders, ect.) added to them, creating two boxes and a fubar-ed layout (if you are text-wrapping, floating).

      I tried just disable the TOC, then re-add it with a shortcode, which I would wrap in a div that I could style, but your amended php file does not have the [toc] shortcode, and I’m having trouble adding it in successfully.

      I’m wondering if either of you fine developers could think of a solution for this issue? I’d love to be able to use this plugin, but unless it’s resolved, I’ll be on the hunt for a new one :(

      Thanks,
      Gabrielle

      1. @Gabrielle, an alternative approach would be to use a separate back to top plugin. I haven’t tried any but the dynamic to top plugin looks alright. If this works for you, then you’ll also be able to use the latest toc+ version.

  3. Hi,

    Maybe something to think about as a future feature. With longer articles it is quite common to use pagination (e.g. online newspaper articles). In that case the TOC would on the first page of the article also show the headings of the other pages and jump there.

    1. Congratulations for your powerful plugin. Do you plan the pagination feature? I’m very interested in that functionality. Greetings from Germany and CU Boeffi

      1. Yeah I got it working for flat lists but need to also get it working when hierarchy has been selected.

      2. Hi Micheal, that feature would be perfect some uses case I have in mind as well. I’ve been looking everywhere for something like that but it doesn’t seem to exist as a feature in a plugin at this stage yet as far as I can tell…

        Do you have a rough idea when you think it might be ready?

      3. @Jason, that’s a good question and I wish I could commit to a release date. I know an update has been long overdue.

    2. Hi,
      The same, I have created pagination (use”pages” to tell about item of pagination leads to not understandable texts…) for long posts. The items of pagination fits with a concept of “part” associated to a level of heading.
      For now the lonely solution is to create manually a TOC for first page and it is impossible (possible but so hard) to get a full detailed TOC of the full post…

      So in my opinion TOC have no compatibility with posts pagination

      1. Self,

        With the Widget it is not the same. The lateral Table content is quite perfect :
        1- contents the whole table even pagination
        2- default css ok while the TOC in line have not a good indentation et height of paragraphs

        With lateral widget can be published without changes

      2. Self,

        Even though the lateral widgets display the whole table when pagination of post is used the links are wrong.

        Table of contents don’t manages the “page” :
        if you are currently on page 3 into the “post” p5 the request to go into an element of the table which is into page 6 will have an url and request

        ?p=5&page=3# which fails it should be
        ?p=5&page=6# which succeeds (manually changed).

        Table content plus remains unusable with post paginated

        note : an internal table (array) should give the “page” of any element, I quickly look at the code for this…

  4. Hi. Is there an easy way to designate the padding between the bullet and bullet text? I haven’t seen anything in the css directly that can affect this. Not sure if its an issue with the theme itself.

    Thanks!

    1. Hi Jas

      The plugin inherits all of that spacing/presentation related stuff from the theme you are using.

      For now at least, you’ll need to use CSS to override the theme margins, paddings, list styles etc which can be difficult if not already familiar with CSS and html. If you provide a link, I may be able to help with the CSS. Email me at michael at this domain.

      I’m thinking of attempting to make some of that presentation stuff more consistent for a new release but don’t think it will be out for another couple of weeks.

  5. Hi,

    Can I use this to create multiple tables of contents? I am trying to create a journal quarterly publication and each issue would have it’s own table of contents. It will likely be built through a custom post type, so the regular posts/pages should be excluded.

    Thanks!

    1. Hi Dana

      Multiple table of contents on the same page/issue – nope. If you create separate issues, then yes a table of contents could appear for each.

  6. try to make plugin toc to work,
    did install
    did activate
    did try other template
    did make page ‘Sitemap’ and added [sitemap] in text on that page
    did write [toc] in header of post and in text body
    did tic ,post. option in options
    but no toc nowhere to be seen
    Thema Evanescence met 7 widgets WordPress 3.2.1.

    1. Hi jJaap

      Do you have at least 4 headings on the post or page you want the TOC to appear?

      Are there any warnings or errors printed to the screen?

      Are you able to provide a link to where you’re trying to use this?

      1. The posts do have headings (I guess) and I had the impression these headings of posts would make the content of the toc.
        That does not work, so I will look for an other solution. maybe another plugin?
        thank for answers.

  7. Great plugin. But, on my multiple-site setup your plugin will not allow me to save separate setting for each blog. Your form action points to a direct path in toc.php:

    action=””

    If you change this to:

    action=”options-general.php?page=toc&update”

    it will allow multi-site users to use your plugin.

    Thanks

    1. That comment didn’t post well. But the line in question is in toc.php like 314. You don’t need the PHP_SELF, you can just start it off with ?page=

    2. Cool thanks – I’ll check it out.

      I’m surprised as I did my testing on a number of multisite installs but didn’t encounter any saving issues. My multisite installs started out as WPMU sites but I don’t think that should have any impact.

      Where did you install the plugin (mu-plugins or wp-plugins)? Did you activate site wide? I would like be able to replicate this and will try on a clean multisite setup.

  8. This is exactly what I needed: thanks very much! It seems really solid: the only minor thing I noticed is on the settings page, which has the word “heirarchy” (instead of hierarchy). If I might make one suggestion, it would also be nice to have a way to disable the numbers generated before the heading names, and to remove the “Contents” heading completely (it leaves a blank space if I delete the text).

    1. Thx for the pick up.

      Re the numbers before the heading: I believe this is coming from the CSS for your theme. I aim to make it a little more consistent in the future though (eg override some of the theme specs like bulleted backgrounds, bullet types, numbering type, and spacing).

      Good suggestion re title. I’ll add an option to remove it completely.

  9. @Aubrey and @Andrew

    I’ve updated trunk with the latest changes which should fix saving on a multisite install using sub folders. You can now hide the title. There are a few other changes so check the changelog.

    I haven’t tagged the release yet but plan to come 1st of Aug as I have a couple other things penned in. If you want to try beforehand, download the ‘Development Version’ from http://wordpress.org/extend/plugins/table-of-contents-plus/download/

    1. Hi Rob. No probs, glad you found some use for it.

      When it takes you to just underneath the heading, are you logged in? Is the admin bar appearing over the top? If so, try enabling the smooth scroll effect which takes the admin bar into consideration. Is it happening without any persistent bars across the top?

      Funny you should mention the heading text as the anchor as I have been debating with myself about this. I would prefer seeing it too but will need to find a way to avoid repetitions (eg you have multiple headings with the same title). I can reuse the heading number but then it would be void when the heading moves elsewhere at a later point. I think that would be acceptable as the user will still be able to figure it out with the TOC index at the top anyway. Btw, this was one of things I was considering for the 1 Aug release so keep an eye out.

      1. I was logged in..great call.

        And I didn’t think about heading repetitions being a problem but I thought about it and now I see what you mean. I’ll definitely keep an eye out for this one. Thanks brother.

    1. Not currently. I can’t think of a situation where this may be used a lot. Are you able to provide one (for a possible future feature)?

      1. I have some pages where I place h1 and h2 tags above the TOC so when the h2 tag is clicked in the TOC, it scrolls up. It’s not a big deal though. I’ll just restructure my pages to have a proper structure..Wikipedia style.

    1. I’m not sure what issue you’re trying to describe as it seems to work. I can’t read Japanese but the headings looked ok to me.

    1. No problems. If you run into any issues, particularly now that it’s using the heading text to create the anchor, please let me know. Not sure how that will work in other languages.

  10. Hi Mike,

    Thanks for making the plugin. I’ve got a weird situation. I’m using some H3 tags on my articles but when I click on the links generated by the plugin, the screen just scrolls to the top.

    My H2 tags work fine. Any ideas what I can try?

    Thanks!

    1. One other thing… Have you considered a [hide] option like you see on Wikipedia?

      It just basically collapses the table down to the header.

      Thanks.

    2. Could you provide a link? I’m guessing the headings may have some invalid characters. Is your site in another language?

  11. Hmmmm, now I seem to having trouble with H2 tags doing it as well. Also, sometimes H2 links in the TOC won’t scroll to the bookmark location either. They either do nothing or scroll up.

    I sent you a link earlier. Let me know if you need it resent.

    Thanks Mike!

  12. Hi there!
    Your plugin is very good and does its job very well! Although there is one thing I noticed about the plugin that is missing. The problem is the TOC appears on the front-page / home-page and I am using excerpts, so it makes it all messy and I would love to have the ability to turn on/off whether or not the TOC shows up on the front-page / home-page.
    I read the thing about using the [no_toc] tag on pages, but if this is possible to use on the front-page / home-page I don’t know how to use it…
    Note: I don’t use a static front-page.
    Thank you for a great plugin and keep up the good work!! :)

      1. Hey Mike, good to see you keeping up with comments. I’m also experiencing an issue with the [no_toc] tag. Its not disabling the toc on my page, within a custom theme div. I’ve tried placing the tag in paragraphs, divs, and at the beginning and end of the page with no avail.

        I ended up using the exclusion rule, but my want those headers included in other TOCs on different pages… let me know if there’s a workaround for this.

    1. Hey, great plugin!

      I am also experiencing the problem where the excerpts posts contain the table of contents t4ext generated by this plugin. I would like to disable the TOC showing up in the excerpt.

      Any ideas?

      1. Ok, I fixed it by editing the table-of-contents-plus/toc.php

        I edited the conditions for displaying the TOC:
        if (
        ( in_array(get_post_type($post), $this->options['auto_insert_post_types']) && $this->show_toc && !is_search() && !is_archive()) ||
        ( $custom_toc_position !== false ))

        By adding the !is_home() condition:

        if (
        ( in_array(get_post_type($post), $this->options['auto_insert_post_types']) && $this->show_toc && !is_search() && !is_archive() && !is_home()) ||
        ( $custom_toc_position !== false ))

        I guess there are situations where the TOC should be displayed on the frontpage, but it would be nice to have an option to control this behaviour.

        Hope this helps!

      2. Thx. There is a new advanced option to enable it for the homepage in the next release. The default will be off.

  13. Hi!
    I just have to say this is the best TOC plugin I have tried so far. One thing though that constantly makes me look for other TOC plugins (haven’t found anyone better yet though =P)
    The problem is that if I have many headers in the post the TOC becomes very long and takes a lot of place. I would like to see a “hide/show” option in a near update so you can choose to hide or show the TOC. Just like in a wikipedia TOC. I’m sure you know what I mean.
    Anyway, thanks for a lovely plugin.

    /Mike

    1. I actually have this ready for the next release :)

      I think its functionality will be enabled by default but if you don’t like it, it can be turned off.

      1. I’m planning an early Sept release. Don’t want to overcrowd August, already been two releases.

  14. Hello,

    I’ve just downloaded your plugin, but i can’t make it display my posts. I’ve been using the shortcode [toc], but it’s not working. can you help me?

    1. Hi Judia – sure but I’ll need more detail to be able to help. Have you had a look at the “Where’s my table of contents?” section under the Help tab in Settings > TOC+ ?

  15. Don’t worry about overcrowding -> overloading us with updates LOL. We all update as soon as we see the message. Some plug-in developers send out updates almost every week and their stuff just keeps on getting better and better. I personally try to update my websites (http://a4jp.com & http://agreatdream.com) and language studying programs every couple of days or by the end of the week, when possible. Your TOC rocks and I would update every day if I knew it was getting better ;)

    Glen

  16. It’s cool to be able to put [sitemap] in a sidebar widget, but what I’m really after is the ability to put [toc] in a sidebar widget.

    I tried it, but nothing renders.

    Can you add this functionality? It should be simple enough — just make the shortcode output a global variable.

  17. Hi Mike,
    Thanks for the great plugin. But I had an issue with it.
    Whenever I click on “continue reading” links in a search results page, I am just going to the top of the page. I deactivated the plugin and everything works fine. What seems to be the problem ? Thanks.

    1. Try turning off smooth scroll in the options as it is hooking into anchor links for the current page (eg hyperlinks that start with #). I know some developers like to use ‘#’ as the destination to trigger other ajax stuff.

      Do you have a link that I can look at to see it in action? The more of these I can see, the better it is I can accommodate for them.

      1. Hi Mike,
        Thanks for the quick reply. Yes, you were right, the problem was with using ‘#’ as the destination. Everything worked fine after I disabled the smooth scrolling.
        I did not provide you the link earlier because mine is a private blog – only for students preparing for competitive examinations in India. If you give me your email ID, I will send a username and password to you to look into it. I feel bad to miss the smooth scroll effect, it was a nice addition.
        Thanks again for your support Mike.

      2. Hi Mike,
        I have seen your email ID in one of the above comments. I have mailed you a link for my website along with a username and password. Please have a look.
        Thanks.

      3. I like the smooth scroll feature too and have a few ideas to try. Quite positive I’ll be able to get it less needy/imposing.

        Got your email so will be in touch when I get a chance.

    1. So you mean pretty much any h2 headings that appear in the content will be excluded? For this example, what about h1 headings?

      Like a minimum heading level option say must be at least h3 or onwards?

  18. great plugin works great except if i have the same headings twice, for example on the main page, if i have one post on top of another, the top smooth scroll will goto the correct, but if i go down post it treats the above post like the 2nd.

      1. not what I meant really, its due to the smooth scrolling issue, i want them to appear on the main page.

        just if theirs 2 posts on the site with identical headings the top post treats as the 2nd post.

      2. Does it work when smooth scrolling is disabled? If they are identical headings (including position of appearance), they would have exactly the same anchor. This obviously is not ideal and is in fact invalid HTML which is why its use on a homepage that lists a number posts should be avoided.

        However, I do have an existing ticket in place to look further into heading duplication avoidance and can add your experience/config to it. If you want to provide a link to help with it, please let me know (email michael at this domain).

  19. Hi Mike, it seems the last update has caused the Genesis Slider plugin to not function correctly. After I installed the TOC update, the Genesis Slider didn’t work correctly on my website. I disable the TOC plugin and the Genesis Slider works again.

    1. Thanks for raising this. I’m looking at the two plugins but in the meantime, try disabling the smooth scroll effect. I might be in touch via email to progress it further.

  20. This plug in seems to be just the thing I need. I basically just want a “table of contents/links” for our catalog as some of our customers seem to have problems with the menu at the top. The sitemap option seemed to be just the ticket and it shows up just fine. I used this code to exclude the other pages on the site: [sitemap exclude="69,729,110,498,692,410,655,507"]

    However all of the site pages are still showing. Is there a way to get those other pages to exclude that I have missed, or have I done the code incorrectly?

    Thank you for any insight you can give me.

  21. I think my email copied incorrectly. It should be [mod email removed: got it thx]. So sorry.

    This plug in seems to be just the thing I need. I basically just want a “table of contents/links” for our catalog as some of our customers seem to have problems with the menu at the top. The sitemap option seemed to be just the ticket and it shows up just fine. I used this code to exclude the other pages on the site: [sitemap exclude="69,729,110,498,692,410,655,507"]

    However all of the site pages are still showing. Is there a way to get those other pages to exclude that I have missed, or have I done the code incorrectly?

    Thank you for any insight you can give me.

    1. Hi Shonie – Currently, you can exclude certain pages by using the [sitemap_pages] shortcode. So for the above example and assuming they were all page ids, you’d use:

      [sitemap_pages exclude="69,729,110,498,692,410,655,507"]

      Similarly, you can exclude categories but you need to use [sitemap_categories].

      Does this make sense?

      1. It does make sense, and I had tried that, well I thought I had. It definitely displays well that way, but it is a moot point at this time. For some reason, TOC+ breaks my gallery and my sharing plug in. :(

        At first I thought it was the product review plugin I had, but it’s definitely this one. Too bad because at first look it was exactly what I needed.

  22. Good morning,

    Thank you for your plugin. I use WP 3.2.1 on Ubuntu 10.4 and Mozilla Firefox 3.6.20.

    I’m relatively new with WordPress. In a single page, I generated the [sitemap] with the following font parameters and it showed as expected on my OS/Browser :

    [sitemap]

    Link : http://mvt.tc/fr/plandusite
    Screenshot : http://mvt.qc.ca/Screenshot.png

    However, on other platforms (iOs, Windows, Apple), the selected font is overwritten with Courier, so it doesn’t look good with the rest of the website.

    I’d appreciate if you gave me a tip of where and how to specify the font in the [sitemap] output.

    Thank you for your help.

    1. Hi Antoine – it looks like you’ve copied the code tags surrounding [sitemap]. Try switching to HTML mode while editing your page and removing all code tags surrounding it.

      There aren’t any custom styles with the sitemap. It uses the styles defined with your theme.

    1. I just checked your site and there is a 404 on the jquery.cookie.min.js file. Shonie and Rob have had this issue too and is caused by a false positive with mod_security blocking requests to files with “.cookie” in the name.

      The file has been renamed and a better fallback has been put in place such that it doesn’t break queued up javascript (for better compatibility). It should be out in the coming days. If you’re finding that it breaks other javascript code, disable “Enable visibility option” until the next version.

      More information can be found at the mod_security bug ticket.

      1. Ahh..thanks. Right now i adjust the width in style.css #toc_container {width:auto !important;} so thats look neat with long headings.

        Can i just select in TOC options rather than style it in theme? or ignore it (only a suggestion) ;)

      2. Does putting it to 100% make it look the same as if it was set to auto? I just tried and I think they’re the same cause the default width for divs are 100%. Were you thinking something else?

  23. Hi, thanks for this great plugin.
    I was wondering would it be possible to add option in administration to switch off automatic registering style.css of this plugin, so I can manually add css to my main css file.
    It would be great because with almost every plugin comes css file and pages are getting bigger and slower.
    I know this way is easier to upgrade css style when plugin is updated, but I think there will not be any major changes in css ;)

    1. That’s a neat suggestion but it’ll only save one TCP request of 1.1k in size for this plugin. Don’t forget that these files (CSS, JS, images, attachments, etc) are cached by the browser next time they’re used so it won’t be pulled from your server. Additionally, the CSS could have been served with gzip compression reducing its size considerably.

      There are methods to improve the efficiency of your site as a whole (W3 Total Cache, WP Super Cache, WP Minify, CDNs, etc) that you may want to look into. They will provide a much bigger improvement than saving 1 TCP hit on first load.

      Don’t get me wrong, as a web developer at heart, I know exactly where you’re coming from. And your suggestion sounds like a nice power option that might make its way in :) Just giving you the full story if you haven’t yet considered them. I could look into minifying the CSS/JS files but again it wouldn’t be saving much.

      1. Wow Mike that was very rich answer :). I was thinking about using caching plugins an I will took it up.
        The reason I contacted you is that this was the latest plugin I installed so it was convinient ;).
        Thanks for answer it was very informative ;)

  24. Hi!

    A great and useful pluggin is that “Content table” but I Think it will be more complete if we can return-back from the destination-link mainly when content is too rich and pages too long.
    Is this an idea for a new future?
    Demo: Table of contents
    Link1
    Link2
    1- You clic on link1
    2- You jump to the content of Link1
    3- There’s a return-back link or an icon at the end of the title of the content
    4- You clic on it and you return back to the Table of contents”

    1. Yep it’s been on my todo list since day one but I’ve put it off as I think through delivery, eg: inline links, persistent back to top link at the bottom, or maybe a persistent toc to the left that appears as you mouse over it.

      I like the last two options but making it work (and look) as intended across many themes would be tricky.

      Imran has provided an inline back to top option here.

      A consideration with inline back to top links is that order may matter for non visual readers (eg screen readers). These readers may read “back to top” before all headings which seems weird as you’ve just gone to a new section of text and that’s how it was introduced. It may not be significant as Wikipedia places ‘edit’ links in a similar position.

      So yes, it is on my list.

  25. I love the plugin. It’s neat, works well and encourages me to use headline tags where previously I used bold text.

    I have a request: can you make it so that the table of contents displays twice?

    Once within the post as it currently does and once ‘collapsed’ as a button at the bottom of the screen so readers have easy access to it. A back-to-top feature in the collapsed button would be great and maybe the button could be positionable by the site owner or drag-n-dropable by the frontend user.

    Anyway, thanks for the plugin. I love it!

  26. REALLY IT IS A GREAT PLUGIN. This is really what I look for since 2 year. I’ve tried many plugins but all of them does not meet what I need. Thanks for this great job.

  27. Hi, I would like to find out how can I adjust this plugin to show the table of contents for only H1 and H2 level headings? It does continue to the level H3 (maybe even H4-H6), which I am using to name the tables.

    1. I’m out of town atm so can’t say which lines they’re on but search for 1-6 which should be on the same line as preg_match and change the numbers to 1-2. You may need to reapply the changes with future updates.

      1. Thank you, it has helped me a lot.
        I would like to change one more thing – a font type and size of the contents text. As far as I have found out there is only an option to adjust the colour values through custom settings panel.

        In addition, I wish this great plugin would have an option to be used in the sidebar widget too. Another plugin called Web Fiction Table of Contents Sidebar Widget does it half-way – only for posts.

      2. The font size is 95% of that set with your theme but you can use custom css to override and define your own specs. I’m still out of town so I can’t give you the exact selectors. Use the custom css plugin to try to experiment.

        Yep the widget is a neat idea and I have it on the todo list.

    1. Sorry, never mind. I just realized that there’s an update to the Light Box plugin that seems to fix the conflict with TOC+. It wasn’t a problem with TOC+ at all.

    1. I think it might be coming from your theme or elsewhere as the toc plugin doesnt add any of that. Youll need to hunt down the cause. My guess woukd be for you to use custom css to hide the background images.

      1. Apparently, the little arrows only show up when I’m signed in. If I sign out, they go away.

        Thanks again for a wonderful plugin.

      2. I’m back at home now so if you provide a link, I should be able to have a look at it and see what’s going on.

    1. OK, I found the wrapping option, but it is a global setting. It would be great to be able to set options on a case by case basis — something like:

      [toc wrapping="right"]

      etc.

  28. Hey there – you forgot to mention the tiny detail of wtf a “heading” is. If I’m trying to put a ToC for 1 page that has multiple sections (“headings”?), how the heck do I mark each section so that the ToC is generated?!

    1. I’ve been meaning to create a video guide but haven’t yet gotten around to it.

      When adding/editing your content, if you’re in the html view, then check out this guide on headings. If you’re on the visual mode, then make sure you’re showing the kitchen sink which will give you two rows of buttons and then use the style drop down (should be the first on the second row) and select headings 1 through to 6 – similar to word processing.

Leave a Reply