Exploring the New Tagging System of WordPress 2.3

Add a Comment

Tagging with WordPress 2.3

Theme Playground is now fully upgraded to WordPress 2.3, and aside from an adjustment or two to this theme everything went smoothly. It feels like about time I looked into adding some tags to the site. So, using some examples here at Theme Playground I’d like to look at some possible uses for tagging as well as ways to display them on a WordPress site.

Reasons for Using Tags Over Categories

Initially I was very apprehensive about incorporating tags into my blogging habits. However, some other’s arguments finally got to me.

Basically categories are great. But, ideally, they aren’t all that descriptive. It doesn’t seem that the Codex gives much of a definitive answer to what categories are, but I would say offer the following description.

A concise descriptive term used to group like posts with other like posts

Rip and tear that definition apart all you want. I’m always interested in getting the best definition in place.

In any case, based off of what I said above, there is something lacking in categories. Or, at least, that’s what the WordPress community has thought for some time, what with the creation and heavy use of Plugins like Ultimate Tag Warrior. Apparently the folks behind WordPress agree, which is why they implemented tags into version 2.3.

So I would suggest using Categories to group posts and Tags to describe them a bit more definitively. This will make more sense with some of the examples I’m going to use below.

Drawing Tags Out of Current Categories

Let’s take a look at a recent post here, called First Hands on Dexter. This post was categorized within WordPress News. But, more specifically, it regarded a new version’s release and upgrading. So, rather than sticking to a broad categorization like WordPress News, it might be better to try the following.

  • Category — WordPress News
    • Tag — Version Release
    • Tag — Upgrading

There’s another way to use tags to improve your organization of posts. Small Potato of WPDesigner.com actually talked about this issue just the other day: trimming down your WordPress Categories to be more powerful. Take a look through your categories and see which ones have only a couple of posts in; group it into a category more general and use tags to specify.

One category I have used to have that is was serving a very limited purpose is was Big Sites Using WordPress. This category was so small, in fact, that up until today there was only one post grouped into it. I think this topic is still worth posting into, though, so deleting it altogether isn’t an option. Instead I deleted the category in question and linked the lone post into a different category: Popularity of WordPress. Then I can separate the two with tags, fitting the idea of them being more specific. In short, it would look like this:

  • Category — Popularity of WordPress
    • Tag — Sites Using WordPress
      • Post Number One
    • Tag — WordPress Chatter
      • Post Number Two

There we go. And actually, the last tag mentioned is another post category I’ll be getting rid of.

Displaying Tags On Your WordPress Site

Okay, so I have the system in place. I have a few tags ready to show off. There are a couple of ways to do it.

The Fundamentals (in the Sidebar)

Probably the first place bloggers will use tags will be in their sidebar in the form of tag clouds. The nice part is that creating a tag cloud is really simple. It’s all built off of the following template tag: <?php wp_tag_cloud(''); ?>

But there is a lot more to that tag than meets the eye (so what else is new for WordPress template tags, right?). Before we dig in, here’s the code I used to put the tag cloud in the Theme Playground sidebar.

<div id="side_tags">
<h3 class="mast">Tag Cloud</h3>
<?php wp_tag_cloud(''); ?>

The code above displayed the following when I loaded up my homepage.

WordPress 2.3 Tagging - Tag Cloud

So that’s a start. But it could use some style. Now I’ve added the following styles.

#side_tags {
margin: 0 0 1em 0;
#side_tags h3 {

So I’m adding a margin to the bottom and center the text in the div, as well as fixed the third level heading to the left (to counteract the center alignment). A little bit better, but not altogether staggering.

WordPress 2.3 Tagging - Tag Cloud (Screen 2)

More Than a Tag Cloud

If you are anything like me, as soon as you hear about a new feature you want to try and use it in a way that no one else is using it. In other words: you want to surprise people, to make them say Wow! That’s our goal with this next tweak to our tag cloud. First I’m going to add a couple of parameters to wp_tag_cloud.

<?php wp_tag_cloud('smallest=8&largest=8&form=list&orderby=count'); ?>

Each of the parameters is pretty self exaplanatory, but just in case they aren’t…

Sets the smallest font size in pts of any tag in the cloud
Sets the largest font size, similar to smallest
Determines how the tags are laid out, whether in a list or simple spewed out with whitespaces.
This parameter determines how the tags are ordered. Here I’ve used count to order them in ascending order from top to bottom.

Once we have this order, a few lines of CSS will make this stand out more than a traditional cloud.

#side_tags {
margin: 0 0 1em 0;
#side_tags h3 {
#side_tags ul {
#side_tags a {
background: url(images/icon_tag.gif) top left no-repeat;
margin:0 0 .5em 0;

Notice that I chose to remove the type of style of the list and replaced this with a background image to the top left of each list item. I’ve found this to be more consistent across browsers than using an image as a bullet.

WordPress 2.3 Tagging (Screen 3)

Keep it Slim and Trim

One thing I dont’t want to happen is for my list of tags to grow much larger than my list of categories. That would be a bit silly. Instead, I’d like to put a limit on the number of tags listed, consequently making the list a list of Top Tags or Partial Tag Cloud. Luckily, the parameter is built right into the template tag. By default the parameter number is set to 45, meaning no more than 45 tags will display. That’s a bit hefty for my tastes, so I’m going to make some adjustments to my HTML.

<?php wp_tag_cloud('smallest=8&largest=8&unit=pt&number=10&order=desc&format=list&orderby=count'); ?>

Notice I added the parameters number and order, which set a limit to the number of tags displayed and determine which way the tags should run (ascending or descending).

For now, I like the way that looks. If you have any better versions of tag clouds, drop them in the comments. If there are enough posted, I’ll put together a gallery post to showcase them all.

For More Tagging Goodness

We’ve only just scratched the surface of displaying tags on your WordPress site. For more detailed information into the tags and parameters discussed here, check out the new Codex pages on tag clouds and template tags. Keep in mind that displaying tags related to posts (similar to how it is commonly done with categories) would be a benefit to the reader.

Please Consider the Following

Just a couple of warnings before you jump onto the tagging bandwagon:

  • Only use tag clouds if it fits with your site. For now I’m going to leave the “cloud” up in the sidebar, although it’s really more of a list at this point. In the end, tags in the sidebar might not work with Theme Playground. It might or might not work for your site as well. Test it out and remove them if it honestly doesn’t work. The last thing your site needs is something else to busy up the page, right?
  • Try and keep your tagging system straight. I have to echo the urgency of Michael Martin’s post earlier today at ProBlogger, in which he vehemently stressed the importance of using the exact same tags throughout your site. Do what you need to do — create a list, a system, or have little reminders if that’s what it takes. Just don’t mess up your brand new system!
  • Try to delete at least one category for every tag you add. This may sound like a harsh standard to keep, but at least for the first tags you add I would strongly encourage it. Most of us have categories running amok (myself included), so it’ about time we pulled the reins back, don’t you agree?

There you are now — happy tagging!