And one more WordPress plugin:
This one makes life easier, when you want some table of content on your pages and posts, based on the H1-Hx tags used to mark the titles.
Usually having a manually managed table of contents (toc) on your page can make some trouble, especially if you update the headers of the different blocks. You find yourself copy-pasting <dir> and <li> tags and block headers around.
This tiny plugin, called „TOC“ makes things easier. It supports one tag you can include anywhere in your posts or pages.
[TOC] will generate a table of contents for your actual post, using the <h1> to <hx> HTML tags in the content of your post.
Here an example. If your document looks like:
<h3>Day 1</h3> Today everything looked fine <h3 style="somestyle">Day 2</h3> Today too <h4>Day 2 - second half</h4> Something strange happened <h3>Day 3</h3> Every thing fine again
Using [TOC] will generate the following table of contents for you:
<dir> <li><a href="#toc0">Day 1</a></li> <li><a href="#toc1">Day 2</a></li> <dir> <li><a href="#toc2">Day 2 - second half</a></li> </dir> <li><a href="#toc3">Day 3</a></li> </dir>
You shurely noticed: The entries of the toc are links. The content of your post is manipulated, so that all <Hx> HTML tags are extended to have a target anchor, which would look like this in the above example:
<h3><a name="toc0">Day 1</a></h3> Today everything looked fine <h3 style="somestyle"><a name="toc1">Day 2</a></h3> Today too <h4><a name="toc2">Day 2 - second half</a></h4> Something strange happened <h3><a name="toc3">Day 3</a></h3> Every thing fine again
As you also noticed, TOC will use the first found H-level as the top-level (in the examples it is 3, since H1 is too big to me). Any higher levels (4, 5, …) will be indented through a <dir> tag.
The [TOC] tag is used within this post.
Version: 1.0 – initial
Tested with WordPress 2.7. Should work on all 2.x versions.
Just upload to your wp-content/plugins folder or any subfolder and activate in plugins menue. Use the TOC-tag anywhere you like and need.
If you like this plugin and it helps so much, that you would like to donate (no matter how much), please do it here.