Table of Contents Generator WordPress plugin 0.3
This is way over due, but I have just committed a new version of Table of Content Generator WordPress plugin. Here’s a list of changes added in release 0.3.
- Inside page/post template, you can use
<?php echo $post->post_toc; ?>to insert the table of content. TOC is now generated for every post, even the ones without<!--TOC-->tag inside the content. Thanks to Scott Merrill at Skippy.net for the patch.
I actually had 0.2 committed early February with unicode fixes, but did not update the web page to reflect the change, so many people had still downloaded the older version, if you downloaded the ZIP instead of from Subversion. It has also now been fixed.
Comments
The reason why TOC plugin does not use “the_content” for filtering is because “the_content” will only be able to get a sub-section of the content, especially in the situation where you have <!–more–> or <!–page–>. “the_content” will only give you the section to be rendered, so that might mean one specific page or the teaser, whereas TOC is especially useful in multi-page long articles, where it can generate TOC for all pages.
For this reason, sorry I cannot put that “fix” in.
Hi.
I just realized I want a plugin (maybe you could help).
The plugin will combine the TOC (table of content) plugin:
http://fucoder.com/code/toc-generator/
With the page spliting plugins that are around.
So there will be the option to autometecly split a post according to it’s headers (and leave the TOC at the begining of the post).
And one more request (and this could be tricky), is to add some sort of taging functionality, so each splited page will be accessible throgh the main web site page, through some sort of taging.
My motivation is that all of my post’s are articles (and I have hundreds of those), which are constructed of diffurent subjects in each post. So they are not very user (or SEO) friendly.
Thanks a bunch,
Tal.
Add a comment
Gravatar is used. Email address is required but will not be displayed. Please keep your comment on topic. No spamming and/or bad language. First time poster will be moderated. Scott reserves the right to delete/edit your comments.

I made the one change recomended by rob to change the add_filter to ‘the_content’ instead of ‘the_posts’ and the plugin plays well with markdown.
add_filter(’the_content’, array(new YLSY_TableOfContents, ‘the_content’));
I might have to look in to having a special template for certain categories that all could use the TOC and then not have to go in and edit each post.
Thanks!!
GaryP