Upgrading to WordPress 2.3 – The Tag Issue

With WordPress 2.3 expected out on September 24th, I’ve been giving the beta releases a whirl to see how what I need to do before I make the final change over.

I currently have 17 plugins(!) installed but I’m most concerned about Ultimate Tag Warrior – will it work in WP2.3?

Short Answer: Not really.

UTW doesn’t play well with WP2.3. Tags show up on posts but there’s a “No Posts Found” error on the link to see other posts with the same tag.

Since I’m only using a small portion of UTW’s capabilities: tagging posts, displaying those tags in my posts and a tag index, I ended up using the UTW importer.

The UTW Importer

Tagging problems in WordPress 2.3While all the post relationships and tags are passed over, tags with more than two words are hyphenated. Yikes! It seems that the importer considers tag names and tag slugs to be the same thing. Hopefully, that will be fixed soon.

Formatting Tags

With WordPress 2.3, there’s a number of tag-related template tags you can use: the_tags(), wp_tag_cloud. Rich Gilchrest has a helpful guide for updating your theme.

But wait, aren’t tags generally lowercase? Yes they are but as you can see in the screenshot above, there are some tags like “post avatar” and “wordpress” that appear as “Post Avatar” and “WordPress”.
This happens when a term, in this case “Post Avatar”, is shared by both a tag and a category. To get around this issue, you can define a css class to use in your templates and set text-transform to lowercase.

.post_tags { text-transform: lowercase}

So, inside index.php, archive.php and single.php I changed the format of the_tags to:

<?php the_tags('Tags: <span class="post_tags"', ', ', '</span><br />'); ?>

For wp_tag_cloud(), your styling options will depend on the cloud format that you choose.

By default, tag cloud formats to “flat”, generating a space separated list of your tags. So your template could look something like this:

<p class="post_tags"><?php wp_tag_cloud(); ?></p>

If you format it to “list”, you will get an unordered list (ul) with the class “wp-tag-cloud”.

Update your css file to reflect this new class:
.post_tags, .wp-tag-cloud { text-transform: lowercase }

The Tag Index

Creating an index of all your tags is quite simple.
First, create a new template (I called mine “Tag Index”) which contains the wp_tag_cloud with the following parameters:

<?php wp_tag_cloud('format=list&smallest=12&largest=12'); ?>

  1. format: I set this to “list” to create an unordered list
  2. smallest and largest: I made the font sizes equal so there would be no trace of the cloud effect. In this case the font size is 12pt

Using the Default Theme as an example, this is what your final template will look like…

Template Name: Tag Index
<?php get_header(); ?>
<div id="content" class="widecolumn">
<?php wp_tag_cloud('smallest=12&largest=12');?>
<?php get_footer(); ?>

Now upload your template and once you’ve done that, create a new Page and assign the “Tag Index” template to it.

Also make sure that the Page Slug is “tag”. If you’re using pretty permalinks you can access your tag index from http://yourdomain.com/tag/.

Whew! One plugin down, 16 more to go!

6 thoughts on “Upgrading to WordPress 2.3 – The Tag Issue”

  1. No problem Rich – it’s a great resource and the examples helped a lot.

    That capitalization was really bugging me so I had to find a work around 🙂

  2. The tag cloud in my blog has <br> tags between the tags of the cloud, making them appear one in each line. Forcing style=flat doesn’t do anything. Any idea?

  3. Hello !!!! 😉
    I am Piter Kokoniz. Just want to tell, that I’v found your blog very interesting
    And want to ask you: will you continue to post in this blog in future?
    Sorry for my bad english:)
    Thank you:)
    Your Piter

Comments are closed.