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.

Screenshots

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.

Help

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 are needed.

Where’s my table of contents?

  1. In most cases, the post, page or custom post type has less than the minimum number of headings. By default, this is set to four so make sure you have at least four headings within your content. If you want to change this value, you can find it under ‘Main Options’ > ‘Show when’.
  2. Is auto insertion enabled for your content type? By default, only pages are enabled.
  3. Have you got [ no_toc ] somewhere within the content? This will disable the index for the current post, page or custom post type.
  4. If you are using the TOC+ widget, check if you have the “Show the table of contents only in the sidebar” enabled as this will limit its display to only the sidebar. You can check by going into Appearance > Widgets.
  5. You may have restricted generation to a URL path match. The setting can be found in the advanced section under Main Options.

How do I stop the table of contents from appearing on a single page?

Place the following [ no_toc ] anywhere on the page to suppress the table of contents. This is known as a shortcode and works for posts, pages and custom post types that make use of the_content()

I’ve set wrapping to left or right but the headings don’t wrap around the table of contents

This normally occurs when there is a CSS clear directive in or around the heading originating from the theme (Twenty Eleven and Twenty Twelve are two themes which do this). This directive tells the user agent to reset the previous wrapping specifications.

You can adjust your theme’s CSS or try moving the table of contents position to the top of the page. If you didn’t build your theme, I’d highly suggest you try the Custom CSS plugin if you wish to make CSS changes.

Try adding the following CSS to allow the wrapping to occur around the table of contents:
h1, h2, h3, h4, h5, h6 { clear: none; }

How do I include the name of the page in the table of contents title?

As the title of the page changes depending on the page you’re viewing, you can use the following special variable to automatically insert the title of the page into the table of contents heading:

%PAGE_NAME%

You can use it as is or place text either side of the variable.

As an example: if your page is named Great Expectations and your table of contents title is set to Contents for %PAGE_NAME%, the final title would read Contents for Great Expectations

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 /doc/).

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 include:

  • 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 developers 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.

The sitemap uses a strange font dissimilar to the rest of the site

No extra styles are created for the sitemap, instead it inherits any styles you used when adding the shortcode. If you copy and pasted, you probably also copied the ‘code’ tags surrounding it so remove them if this is the case.

In most cases, try to have the shortcode on its own line with nothing before or after the square brackets.

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

ShortcodeDescriptionAttributes
[ 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.
  • 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.
  • 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 (defaults to true), does not separate the lists by first letter when set to false.

For developers

How do I customise my anchors?

If you’re still not happy with the anchors, you can modify them to suit your needs through a custom function hooked into the toc_url_anchor_target filter. As an example, place the below code snippet into your functions.php file to convert all anchors to uppercase.

function my_custom_anchor( $anchor )
{
	return strtoupper( $anchor );
}
add_filter( 'toc_url_anchor_target', 'my_custom_anchor' );

toc_get_index( $content = ”, $prefix_url = ” )

Returns a HTML formatted string of the table of contents without the surrounding UL or OL tags to allow the theme editor to supply their own ID and/or classes to the outer list.

Both parameters are optional:

  • $content is the entire content with headings. If blank, will default to the current content found in $post (eg within “the loop”).
  • $prefix_url is the URL to prefix the anchor with. If a string was provided, it will be used as is. If set to “true” then will try to obtain the permalink from the $post object.

These examples assume you are within “the loop”:

  1. Obtain the index for the current page
    echo '<ul id="my_toc">' . toc_get_index() . '</ul>';
  2. Create a listing of all children and their headings
    $children = new WP_Query(array(
    	'post_parent' => get_the_ID(),
    	'posts_per_page' => -1	// get all children
    ));
    while ( $children->have_posts() ) {
    	$children->the_post();
    	echo 
    		'<h3>' . get_the_title() . '</h3>' .
    		'<ul>' . toc_get_index( get_the_content(), get_permalink( $children->post->ID ) ) . '</ul>'
    	;
    }
    wp_reset_postdata();

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.

1,136 thoughts on “Table of Contents Plus

  1. Hi,

    I am trying to use this plugin in my site but doesn´t generate anything. I have done all the tutorials in the world but it is impossible. I have deactivated all the plugins except Table of contents, I have tried to insert the shortcode….

    My site is invitacionesdebodaya.com and I use twelve twenty theme

    I look forward to hearing from you because I really need it

    Regards

    Jorge

  2. Trev says:

    Can I suggest you reverse the order of these comments so the most recent appear at the top since those are likely to be most relevant to the current release?

  3. Trev says:

    Hi,
    We found the latest v1507 is not backward compatible and caused our CPU usage to hit 100%. Reverting to v1408 fixed the issue again. The difference is that in v1408 you allowed a lowercase shortcode [toc] see http://dublue.com/plugins/toc/#Shortcodes but the code in v1507 looks for uppercase [TOC]. For some reason having a [toc] on the page caused the page to be rendered 100s of times creating one _very_ long page at the end of which was an out of memory error.

    Backwards compatibility would be preferable, if not then code to catch the loop is needed.

    Thanks in advance

  4. Alex B. says:

    Hi, let me first tell you that I *love* your plugin. However there is a tiny issue – on my homepage even if I place [no_toc] it still shows a table of contents. I’ve tried to find if there was [toc] or any other code on this page that is forcing the table to show, but I didn’t find anything. I am leaving my email address. Please shoot me a replay so I can show you the URL. Thanks in advance.

  5. Hi,

    I have installed the table of contents, and it is great, over when I split my article into two pages the table of content only covers the page that it is on.

    Is there a way to make sure he table of contents includes the content on both pages?

  6. WordpressUser says:

    Hello, I use TOC + on my website. I noticed that when « ‘ » was inserted the summary wasn’t working. Do you have an answer to this problem ?

    (sorry for my bad English, I’m French.)

  7. seokomodo says:

    I want to use the [sitemap] shortcode to display a sitemap of all the pages of a specific custom post type, but the shortcode isn’t displaying the sitemap.

    I am using the following format [sitemap_my_custom_post_type]. any ideas?

  8. Pingback: 記事内に自動で目次をつけるプラグイン「Table of Contents Plus」の使い方 | 左坊のメモ帳

  9. virtualblueridge says:

    Hello… this is a new support request on the wordpress plugin page. I’m hoping that you might be able to address and give some clues:

    Link:
    https://wordpress.org/support/topic/incompatibility-with-shortcode-ultimates-su_posts-shortcode

    Text:
    On a page, I use several headers tags. I also use Shortcode Ultimate’s (https://wordpress.org/plugins/shortcodes-ultimate/) su_posts shortcode in order to have some posts in the same page.

    Alas, even if I add a [toc] shortcode, the table of content won’t appear.

    Here’s an example : http://www.blandinedufleuve-lyon.cef.fr/actu/test-3/

    I’m no dev, but from a dive into the code, it seems TOC+ disables itself if there is a posts loop in the page. Am I right ? Is there any way to fors the TOC to appear ?

    Thanks.

  10. Hello,

    On a page, I use several tags. I also use Shortcode Ultimate’s (https://wordpress.org/plugins/shortcodes-ultimate/) su_posts shortcode in order to have some posts in the same page.

    Alas, even if I add a [toc] shortcode, the table of content won’t appear.

    Here’s an example : http://www.blandinedufleuve-lyon.cef.fr/actu/test-3/

    I’m no dev, but from a dive into the code, it seems TOC+ disables itself if there is a posts loop in the page. Am I right ? Is there any way to fors the TOC to appear ?

    Thanks.

    • Mike T says:

      Have you tried without entering [toc] (eg let it automatically do its thing)?

      In the source, I can see that the [toc] shortcode has run and planted an anchor as to where the TOC will appear but the second part hasn’t run at all. The second part places the TOC at the position and updates the headings with anchor tags. This is triggered when the_content is fired. Do you have something (in other plugins or your theme) that is tampering with the_content filter?

  11. Hi,
    i’ve expanded my category pages with usefull content. Now i want to use the TOC+ function on these category pages but it doesn’t work automatically neither the shortcode works.

    Anything i can do?

    Greetings

  12. Awesome, finding a alternative plugin for my website and now i found it. If you have long content pages on you website with many information and heading/sup-heading, you should use this plugin in order to sumarize the information in a shortern table, it will help the reader found the info easily, it also helps to attact audience to your wesite.

    Thanks Mike,

  13. I am using:
    [sitemap_categories exclude="1"]
    on a separate page that meant just for those of us doing some specialized development. One of the categories goes 3 levels deep:
    cat1
    …cat2a
    ……cat3a
    ……cat3b
    ……cat3c (etc)
    …cat2b (etc)

    Have you considered allowing us to show the total number of posts associated with each category? Keep in mind that if you would allow this, the higher levels would need to include the counts from all associated sub-categories.

    I have searched extensively and your plugin is the first one that comes close to our needs. Thanks.

  14. Hey Mike,

    first of: awesome plugin!

    Two things I would love you to add:

    1. Different classes for headings to make h1 headings stand out more from the rest. This is really important so users see major headings faster.

    2. Have a look at this joomla plugin: http://www.ubertoc.boomstrap.com/
    The sidebar feature is awesome and would make your plugin stand out even more.

    Maybe something to add to a premium version.

    Thanks

    Hendrik

  15. Hi I want to show posts of only a specific category out of 40 categories. How to achieve this?
    There is exclude attribute but not include attribute. So I can’t use exclude attribute and manually write those 39 category names to exclude.
    Also how to find category id?

  16. Hi, Mike! Thanks for great module!

    I see that front.js generates js error on my site. Can you send me unminified version? So I can debug where I get problem. After that I will send you report.

  17. Jaroslav Uhlir says:

    Hey there,

    I have a small issue with your great plugin. I would to like create anchor link to each header (h2,h3,.. etc), but if I click to the anchor link by headline in content isn’t working because this plugin replace “site.com/#anchor_links” to “site.com/”.

    How can I keep that “#anchor” after link and anchor will be working?

    Thank you

  18. Hello again,

    I am reporting a bug.

    If “Enable smooth scroll effect” in the settings is turned on, than Markdown (or Parsedown) footnotes won’t work. In this case when one clicks on a footnote number, the page will scroll back to top; the page position will be at the footnote after a refresh.

    If the option is turned off, then both TOC and Markdown footnotes work well. The problem can be reproduced.

    There is also a similar issue on Github in 2013. See here: https://github.com/stephenharris/WP-MarkDown/issues/32

    On my site I am using the codes from here (http://www.codecheese.com/2013/11/create-back-to-top-button-for-wordpress/) to create a scrolling-back-top link on page. Not sure if the the three things have compatibility issue.

    Thank you very much.

  19. Hello Mike,

    Thank you for your great plugin!

    I tried your TOC sidebar widget with [GilidPanel](http://codecanyon.net/item/gilidpanel-wordpress-sliding-panel-sidebar/5753924) , but the widget cannot be seen. However it does take effect because a TOC is not shown in a post/page header. I have purged cache but it still dosen’t show up.

    I wonder if you could have a look at the problem at egosum.club? With a TOC widget in GilidPanel or something alike, readers will be able to access to the TOC at any position of the webpage and that’s really convenient.

    Thank you very much.

  20. Hi there, thanks for this great plugin!

    I have a request related to the ‘css_container_class’ value of get_option(toc-options). I understand from the feature release post that it works with the shortcode to let you add custom classes to the container, but in my case I want to add classes to every TOC inserted in posts. Specifically I want to insert .alignright because with it I can take advantage of the responsive CSS styles I already use for floated images in posts.

    As-is there’s no clean way to filter the results for all TOC. Ideally you might add an option to the advanced section of the settings page.

    On a simpler level you could just add a filter for the value into your plugin, like:

    $container_class = add_filter('toc_options_css_container_class', $container_class);

    That would let me easily insert things with a filter.

    Right now the only way to get this effect is to filter the entire options function, which works but risks contaminating the value if not handled carefully.

    Here’s a Gist with my code that works currently:

    https://gist.github.com/jeremyclarke/81a1b06c511f0ba5d8cd

  21. [x] “Hide the table of contents initially” – does not work anymore. I used the latest before and after updating a THEME.

  22. Dear Michael Tran,

    Thanks for nice plugin.

    I have a problem with it and It like a feedback to you.

    The problem is translating Vietnamese char to Global char without accent. Same as Ê -> E, Á -> A, Ư -> U,…

    Every update, I must hack your code to fix it.

    I think you can do it with a simple codes.

    I used bellow code, inject to your url_anchor_target function.:

    $trans = array(
    “đ”=>”d”,”ă”=>”a”,”â”=>”a”,”á”=>”a”,”à”=>”a”,”ả”=>”a”,”ã”=>”a”,”ạ”=>”a”,
    “ấ”=>”a”,”ầ”=>”a”,”ẩ”=>”a”,”ẫ”=>”a”,”ậ”=>”a”,
    “ắ”=>”a”,”ằ”=>”a”,”ẳ”=>”a”,”ẵ”=>”a”,”ặ”=>”a”,
    “é”=>”e”,”è”=>”e”,”ẻ”=>”e”,”ẽ”=>”e”,”ẹ”=>”e”,
    “ế”=>”e”,”ề”=>”e”,”ể”=>”e”,”ễ”=>”e”,”ệ”=>”e”,
    “í”=>”i”,”ì”=>”i”,”ỉ”=>”i”,”ĩ”=>”i”,”ị”=>”i”,
    “ư”=>”u”,”ô”=>”o”,”ơ”=>”o”,”ê”=>”e”,
    “Ư”=>”u”,”Ô”=>”o”,”Ơ”=>”o”,”Ê”=>”e”,
    “ú”=>”u”,”ù”=>”u”,”ủ”=>”u”,”ũ”=>”u”,”ụ”=>”u”,
    “ứ”=>”u”,”ừ”=>”u”,”ử”=>”u”,”ữ”=>”u”,”ự”=>”u”,
    “ó”=>”o”,”ò”=>”o”,”ỏ”=>”o”,”õ”=>”o”,”ọ”=>”o”,
    “ớ”=>”o”,”ờ”=>”o”,”ở”=>”o”,”ỡ”=>”o”,”ợ”=>”o”,
    “ố”=>”o”,”ồ”=>”o”,”ổ”=>”o”,”ỗ”=>”o”,”ộ”=>”o”,
    “ú”=>”u”,”ù”=>”u”,”ủ”=>”u”,”ũ”=>”u”,”ụ”=>”u”,
    “ứ”=>”u”,”ừ”=>”u”,”ử”=>”u”,”ữ”=>”u”,”ự”=>”u”,’ý’=>’y’,’ỳ’=>’y’,’ỷ’=>’y’,’ỹ’=>’y’,’ỵ’=>’y’, ‘Ý’=>’Y’,’Ỳ’=>’Y’,’Ỷ’=>’Y’,’Ỹ’=>’Y’,’Ỵ’=>’Y’,”Đ”=>”D”,”Ă”=>”A”,””=>”A”,”Á”=>”A”,”À”=>”A”,”Ả”=>”A”,”Ô=>”A”,”Ạ”=>”A”,
    “Ấ”=>”A”,”Ầ”=>”A”,”Ẩ”=>”A”,”Ẫ”=>”A”,”Ậ”=>”A”,
    “Ắ”=>”A”,”Ằ”=>”A”,”Ẳ”=>”A”,”Ẵ”=>”A”,”Ặ”=>”A”,
    “É”=>”E”,”È”=>”E”,”Ẻ”=>”E”,”Ẽ”=>”E”,”Ẹ”=>”E”,
    “Ế”=>”E”,”Ề”=>”E”,”Ể”=>”E”,”Ễ”=>”E”,”Ệ”=>”E”,
    “Í”=>”I”,”Ì”=>”I”,”Ỉ”=>”I”,”Ĩ”=>”I”,”Ị”=>”I”,
    “Ư”=>”U”,”Ô”=>”O”,”Ơ”=>”O”,”Ê”=>”E”,
    “Ư”=>”U”,”Ô”=>”O”,”Ơ”=>”O”,”Ê”=>”E”,
    “Ú”=>”U”,”Ù”=>”U”,”Ủ”=>”U”,”Ũ”=>”U”,”Ụ”=>”U”,
    “Ứ”=>”U”,”Ừ”=>”U”,”Ử”=>”U”,”Ữ”=>”U”,”Ự”=>”U”,
    “Ó”=>”O”,”Ò”=>”O”,”Ỏ”=>”O”,”Õ”=>”O”,”Ọ”=>”O”,
    “Ớ”=>”O”,”Ờ”=>”O”,”Ở”=>”O”,”Ỡ”=>”O”,”Ợ”=>”O”,
    “Ố”=>”O”,”Ồ”=>”O”,”Ổ”=>”O”,”Ỗ”=>”O”,”Ộ”=>”O”,
    “Ú”=>”U”,”Ù”=>”U”,”Ủ”=>”U”,”Ũ”=>”U”,”Ụ”=>”U”,
    “Ứ”=>”U”,”Ừ”=>”U”,”Ử”=>”U”,”Ữ”=>”U”,”Ự”=>”U”,);
    $return = strtr($return, $trans);

    Again, Thanks for nice plugin

  23. Billy says:

    Hi dude! Is there any news on using [toc] shortcode inside the widget?
    Here is what I’m trying to achieve – https://dev.twitter.com/docs
    – Name of the current page
    – Heading 2
    – Heading 3
    – Heading 2
    -….
    – Name of another page
    – Name of another page

    And all that stuff inside the widget. Is that possible?

    Thank you very much for creating awesome stuff like that.

  24. Sven says:

    Hi, is it possible to embed the toc two or more times on the same page?

    This is why I ask for it: I’m using tabs which means that the headings of all tabs are listed in the toc. It would be ok for me to use different headings (h5, h6) for each tab and to insert the shortcode with the coresponding heading. But if I place the shortcode more than one time only the configuration of the last one is respected and the toc is shown where the first code is placed.

    Thanks for any hint!

    • Mike T says:

      You could use some basic jquery functions (insert, before, after, append, etc) to copy the TOC to multiple positions on the page. Definitions and examples are at http://api.jquery.com/category/manipulation/

      Another way may be to edit line 1668 of toc.php from:


      if ( $custom_toc_position !== false ) {
      $find[] = '';
      $replace[] = $html;
      $content = $this->mb_find_replace($find, $replace, $content);
      }

      to


      if ( $custom_toc_position !== false ) {
      $content = $this->mb_find_replace($find, $replace, $content);
      $content = str_replace('', $html, $content);
      }

      It’s very quick and dirty and will have some flow on issues like multibyte support, possibly show/hide issues. It’s all because there is an ID on the original TOC and IDs are meant to be unique. I might have more of a play for a new release.

      • Mike T says:

        Umm, the empty quotes around $find[] and str_replace are meant to be ‘< ! – – T O C – – >’ without the spaces in between.

    • Mike T says:

      Yep, the Ample theme’s stylesheet at line 1414 has the following display: inline-block; which affects all bulleted list items to appear that way. Fix it for the TOC by adding the following CSS:


      .toc_list li, .toc_widget_list li {
      display: block !important;
      }

  25. Can you maybe add a comment with the code that’s responsible for “Hiding the table of contents initially”?

    Then I’ll communicate that to the Thrive support team so they can check it for conflicts.

    • Mike T says:

      Do you have a link exhibiting this problem with the Thrive things? Might help in describing the conflict.

      Another consideration is that if the TOC is displayed by default (that is you haven’t clicked ‘Hide the table of contents initially’ in the general options) and you click the hide button from the article to hide it, this action sets a cookie so that it remembers your decision and will be applied on every article with a TOC on your site.

      The cookie is named “tocplus_hidetoc”. So just in case you’re refreshing like mad and expecting “default” behaviour, it won’t happen when this cookie is present due to preference setting. Reshowing the TOC will remove the cookie.

      • Actually after some further investigation…

        What really happens is that:

        1) On first visit the TOC menu is collapsed like it should.

        2) If the menu is expanded it stays expanded, hiding it again won’t keep the TOC hidden when I reload the page. Unless…

        3) I visit the page again next day… Then the TOC is collapsed again (I assume because the “tocplus_hidetoc” cookie is expired by that time)

        Concluding thoughts:

        So what seems to happen is that the tocplus_hidetoc cookie value is set only when I “Show” the menu, and not when I “Hide” the menu.

        Here’s a link to a picture gallery about the island Boracay that is exhibiting this problem: http://boracaycompass.com/pictures/

        I display the TOC using [toc label="Quick Gallery Navigation" collapse="true"]. “Hide the table of contents initially” is also checked in settings. And auto insert is disabled for all content types.

        Any way to fix this on your end?

      • Mike T says:

        There may be more than one issue here. First, there may be a logic issue in that the cookie is being used for the inverse reason when collapse=true is set. I’ll look to address this so that it is inline with how it has worked previously.

        If I recall correctly, the cookie should have had a longer expiry time (30 days).

        I’ll check out your link when I get some time.

  26. Also the “Hide the table of contents initially” in the main settings area doesn’t seem to be working for TOCs that are displayed using [toc]

      • No Javascript errors. Just debuged and removed any that I had. Also I debugged by disabling all my other plugins and then re-enabling them, but no luck.

        The thing is this feature of TOC+ is very unpredictable in my case. Sometimes it works sometimes it doesn’t, just randomly…

        I thought I finally found the culprit (a plugin conflict), but then after further testing that just seemed to be another random event (TOC hide initially just happened to work after I disabled that plugin a few times).

        So I’m really not sure what to do know, I really want this feature, but how to get it working, I don’t know.

  27. Hey, great plugin, love it! Any change you can add an option to [toc] to “Hide the table of contents initially” or to show it initially?

    Because some of my TOC’s are very large and take up a lot of space, so I want to hide them initially. But the smaller ones I want to show since they don’t take up too much space / don’t distract the user too much from the main content.

    Would love it if you could add that, then it’s really a perfect plugin to me. Thanks for creating the plugin and sharing with the world!

    • Mike T says:

      Yeah it’s been there for a week. Make sure you have version 1505 and then use [toc collapse="true"]

      It was mentioned in the changelog.

    • Mike T says:

      Not currently but I’ve thought about this before. You can certainly use CSS3 columns to do this but watch out for browser support, particularly IE10.

  28. hi thanks for this plugin,
    I’m writing in German language: our special chars like Ö,ö Ü,ö ß,Ä,ä are ignored by your plugin,
    #Tipps-zu-den-5-User-Rollen-fr-1-User-bei-WordPress
    look at “fr” in this anchor it must be “fuer”
    Ö or ö must be Oe or oe
    and Ä must be Ae or ae
    and ß ss
    is this possible?

    best regards

    Monika

  29. Pingback: Table of Contents Plus 1505 released | dublue

  30. Michael Davis says:

    Just installed your plugin on my sandbox/test site to play around with it. Really like it and see alot of potential for use. However, I think that due to the way my theme is using the menu at the top of the page, when I click on a section heading in the TOC, it “jumps” just past that heading into the paragraph below it. I am sure there is probably a way to correct this, but I am basically a newbie at all of this and am not sure what I need to do. The link to the page I am referring to on my test site is:

    http://www.dadsandbox.com/table-of-contents-test/#This_is_the_Third_Heading

    If you might have any insight on how I could correct this, I would be very grateful.

    Thank you!

    • Mike T says:

      Try turning on Smooth Scroll in Settings > TOC+. If you need to adjust the height offset, it’s in the advanced section.

  31. Bosse says:

    Hey, awesome plugin! Are there any plans on adding collapsible headings in TOC? I have a project where I need ~150 items added to the table of contents, and it would be really nice if individual categories within the TOC could have a hide/show toggle as well. Any pointers as to how I can implement it myself?

  32. I love this plugin! So often you download something that doesn’t live up to expectations but this exceeds them, well done.

    I have one question, however. Is it possible to ‘hide initially’ on individual pages? I would like TOC+ to start off as open for most of my pages but one or two have a huge amount of content so I would like TOC+ to start off closed on those. Can this be done?

    • Mike T says:

      No you can’t hide on a per page basis but it might make its way into the next release later this week.

  33. hello, TOC+ looks like just what we need, but… I cannot get it to appear in any of the positions (header, primary sidebar, etc.) in a theme from Studiopress (eleven40). I am hoping it is something simple, but what might that be? thanks for any help. Kurt

  34. I have two questions…1) Is there a way to make this floating, so as the user scrolls down the page, they can still see the TOC? and 2) If the answer to 1 is yes, is there a way for the section the user is looking at to be highlighted in the TOC? Thanks
    Heidi

  35. I have a documentation website on TikiWiki with 4 chapters, which contain 184 pages with hundreds of sub-sections on those pages. All of those are identified with H1 – H5 headings. Can TOCplus generate a “whole book” TOC from this? Can it also produce intermediate TOCs by chapter? Total size in PDF form is about 800 print pages.

    • Mike T says:

      It’s possible but you’ll need to be a developer and add some PHP to your theme. There is an example in Help > For developers, toc_get_index. The result is what I did for the Annual Reports at http://aofm.gov.au/publications/annual-reports/annual-report-2013-2014/

      Whole book or chapter TOCs would be achieved by the same code (give me all headings for all descendants).

      I would have some considerations in your situation though:

      * Performance: building a TOC on your full site would be very taxing to produce as it would need to obtain the content for every published page in correct hierarchical order. My annual reports worked OK as it was only 7 pages.
      * Moving from TikiWiki to WordPress would probably restrict edits, removing the possibility for community contributions.

  36. Benjamin says:

    Hello,
    thank you for this plugin! Its great. But i have a problem…
    The plugin ignore only one heading when im typing in the option heading*
    but it doesnt work when im using heading|heading|heading or *heading*

    Have you got any idea? 🙂 Thanks so much.

    • Mike T says:

      It works for me as expected. Entering heading* will hide all headings that start with heading.

      Have you got a link with the problem?

  37. Pingback: Neues: Neue Features auf der Seite | thuemichen.de

Comments are closed.