WordPress jQuery Table of Contents plugin

A Tech article with View Comments posted 10 January 2010.
Tags: , ,

I’m proud to announce my first WordPress plugin, “jQuery Table of Contents,” which inserts the lovely little table of contents you see on many of the pages of my website. It uses jQuery to inspect the content of your post or page and generate table of contents links based on the header tags. It’s easy, SEO friendly, and highly customizable.

Download


Download from Wordpress Extend

Is this plugin helping you make money? Buy me a cup of coffee!


Installation

  1. Upload `jquery-toc.php`, `jquery-toc.css`, and `jquery-toc.js` to the `/wp-content/plugins/jquery-toc/` directory.
  2. Activate the plugin through the ‘Plugins’ menu in WordPress
  3. Important! – Configure the Table of Contents to customize it for your theme.

Demo

You’re looking at it. This site has a working example of the plugin. Look at the pink box in the top-right corner of this post.

Frequently Asked Questions

Q: Does this plugin work automatically for every theme?

A: Nope. The default settings provided will work out the box for the Wordpress Default (Kubric) theme. Beyond that, you may have to change settings to get it to work with your theme.

Changelog

  • 1.0 – First public release

You might also enjoy:

  1. Simple Table Of Contents in JQuery
  2. Freedom Software, Competition, and WordPress Plugins
  3. RefTagger Plugin for Bible References in Wordpress
  4. Liturgical Wordpress, part deux
  5. WP Greet Box is Great

  • It would be great if you could share some screenshots or a live demo of the plugin? I would like to see the implementation before I start using it.
  • Navjot - You can see it working on this same page.
    Click any of the starred words in the pink box!
  • RavanH
    Excellent! Could you pllease let me know when that happens and post a link? I have subscribed to these comments...
  • RavanH
    Oh, your comment feed has bad syntax and doesn't work on my reader... subscribing via e-mail then.
  • My apologies - I'll be looking into that ASAP.
  • RavanH
    Hi, will you be hosting this plugin on WordPress Extend?
  • Yeah, I've applied for access, and I'm just waiting to hear from the admins there to get the plugin hosted.
  • May I ask why you created this if SEO Table Of Contents already exists and is pretty mature? http://hackadelic.com/solutions/wordpress/toc-b...

    I'm all for new plugins, of course, but can you tell us how it is different, other than that it uses jQuery vs PHP? Is there any benefit in doing so, other than saving server time?

    Thanks.
  • Artem - Thanks for your question. I can think of a number of advantages. Besides saving server time, my plugin:

    <ol>
    <li>Doesn't insert the TOC into the html of the document, which makes for cleaner markup.</li>
    <li>Simpler to configure to get a usable TOC out of the box.</li>
    <li>Inserts automatic links back to the top of the document.</li>
    </ol>

    It also has some technical merits that I think are worth considering:

    <ol>
    <li>Doesn't try to parse HTML with PHP. Web browsers and Javascript are designed to handle manipulating the DOM already, so I think it's a superior tool.</li>
    <li>Much simpler PHP plugin code means that there is less to break in future PHP and WordPress upgrades.</li>
    </ol>

    SEO Table of Contents isn't a bad plugin at all, and if it meets your needs, please use it. But if all you want is a simple table of contents that you don't have to think much about, my plugin fits that niche pretty nicely.
  • This post has more detail on the debate over the implementation of this plugin.
blog comments powered by Disqus