The Overlooked “Tag” Tags

OK, I admit being a sucker for all the “tag hype” in the WordPress Community too. I’ve seen all the WordPress bloggers (that is, bloggers who specialize in WordPress tips) try to be the first to write a tutorial on how to implement tagging in your WordPress theme. I’ve even been tempted to do it myself, although I’ve resisted.

And I subscribe to a good many blogs that specialize in this kind of information too.

And as I’ve been following these blogs, I’ve been waiting on one, JUST ONE, to mention the 2 template tags for “tags” that I noticed in the Default theme that came with my WordPress 2.3 beta download. Seriously, I’ve been waiting to see how long it would take for someone to realize that no one has written on them yet and capitalize on it. But as of yet, no one has (at least that I have seen). So, I decided to take a few minutes and let everyone know about two overlooked template/conditional tags that are available for the new version of WordPress:

Conditional Tag: is_tag()

I’m not sure if everyone is familiar with conditional tags. If not, they’re basically a way for you to insert some conditional code to display some kind of information only if the condition is met. For instance, let’s say you wanted to display a huge yellow duck in your sidebar when a person is on your about page. Just use the conditional tag if (is_page(‘about’)) and then put in the code to display the duck. For more on conditional tags, check this out.

So the is_tag conditional tag can be used in many different ways, but the one instance in which I found it used was in the archive.php page, where the condition went like this: If this is a tag archive, then display the tag title in the header.

Which brings me to overlooked template tag number 2:

Template tag: single_tag_title()

What’s odd about this is that it isn’t even listed in the official WordPress template tag directory!!! However, I did find it being used in the Default theme that came with 2.3 as well.

Where can I use this tag?

Again, the archive.php page is where I found it, and that’s the best place for it to be used. When listing a tag archive, you can use the single_tag_title() to display the tag title as the header of the page.

OK, so neither of these are really as important as the_tags or wp_tag_cloud, but it was still disappointing to see them being overlooked.

So get out there are start updating your themes for the new tagging system! And don’t forget the oft’ overlooked tags I talked about today, either!

2 Replies to “The Overlooked “Tag” Tags”

  1. I had no idea. Good info, and definitely worth adding to a theme. Thanks!

  2. Richard,
    No problem bro. Glad you found it useful. Also, I noticed the link love a few days ago. Thanks man!

Comments are closed.