WordPress tags etc

For a while I have been adding tags to my posts. Tags are good. People who tag things are good. I am Web 2.0.

Only thing is they seemed to be going in to the ether, that is to say, users (that is you) had no way to see them or browse them. I was suprised that there aren’t any real options in the WordPress admin website, and considering they were only introduced in version 2.3 I was suprised I didn’t find more information on the web as to how to make use of them. I had read that WP supports things like tag clounds out of the box, but couldn’t see how to make one for my blog.

I suspected part of the problem was that existing themes hadn’t been updated to make use of them (but it seemed the ‘Default’ theme lacked support for them as well, at least the version on Dreamhost seem to).

Anyways, I found a few things:

  • You can create special pages like Archives and Sitemap. I actually found this as a theme I was playing with (Copyblogger) had a link at the top of the page called Archives but it didn’t work. This page on Andy Sylvester’s blog explains how to fix this. You basically create a page (not a post) called ‘archives’ or ‘sitemap’ etc, and under ‘Page Template’ (near bottom of the composistion page) you can select templates such as ‘archives’ or ‘sitepmap’, these seem to be dependent on your theme. Finally save it blank. He mentions to set the ‘slug’, but I can’t couldn’t see an obvious way to do this with the new composistion interface in WP [update: while writing this very post i have just noticed you just have to click on the ‘Permalink’ underneath the Title].
  • I also found this page on Rich Gilchrest website (at the time of writing it wasn’t working and had to use the Google cache copy), which explains how to add code to existing templates. So I’ve added some code to index.php and archives.php for this theme (Greening) – which doesn’t have a ‘sitemap’ template, which others seem to.

This is the code I added to archives.php using the theme editor within the admin interface for WP. Note I added a line-height as the larger tags seemed to overlap tags on the lines above, though even with this, there seems to be problems clicking small tags that are directly above larger tags.

<h2>Tags</h2>
<div style="line-height:210%;">
<?php wp_tag_cloud('smallest=8&largest=36&'); ?>
</div>

And the code I added to index.php

<?php the_tags("Tags: "); ?><br />

So now I have a tag cloud and archives page here. And you should be able to see (and click on… you know you want to) tags at the bottom of this post.

Of course, as is the law, on finsishing this I find two pages on the wordpress site that for reasons unknown I was incapable of finding before.