With the release of WordPress 2.3, the heavily anticipated feature of a built-in tagging system was finally made available. Bloggers rejoiced, because tags have for a long time helped us navigate through content heavy websites by attaching specific keywords to each entry or article, and now we would finally be able to do this for ourselves at our own blogs.
Unfortunately, many bloggers found themselves unable to take advantage of this new feature because the themes they were currently using at their blogs didn’t support tagging. This quick guide will show you just how easy it is to modify your theme and finally take advantage of the tagging system.
Step 1: Include tags on single post pages.
The first thing you need to do is login to your WordPress Admin Section, and head to “Presentation” and from there “Theme Editor“. Once there, click the link in the right menu that says “Single Post“, and this will take you to the template for the single post pages. Next, you need to determine where you want to include the tags. If you’re not familiar with coding at all, it will look a little greek to you, but do not fret. All you need to do is insert this single line of code:
<?php the_tags(‘Tags: ‘, ‘, ‘, ”); ?>
This will insert the tags for that specific article right where you put the code, with the word “Tags: ” in front of the tags and separate each tag with a comma and a space. You can of course alter the code to make it say and look like you wish.
Step 2: Alter the archives page to display tags like it should.
Now we need to make sure that the page which is displayed when the visitors click a tag looks just like it should. Now WordPress actually gives you the possibility to create a separate page for tags, but for the sake of simplicity we will in this tutorial modify the existing archives template. In the right menu of the template editor, click the link that says “Archives“. Now you should find something that looks remotely similar to this:

Each of these conditional statements make sure that the correct headline is served when a user is browsing the archives. If you look closely, you can see that the statement for tags in my theme looks like this:
<?php /* If this is a tag archive */ } elseif (is_tag()) { ?>
<h3 class=”sec-title”>Articles Tagged With ‘<?php echo single_tag_title(); ?>’</h3>
Of course, you will need to modify that piece of code to fit in with the style of your other archive pages. It is likely that your theme uses a completely different class for headlines, for instance h2 and a class called “archive headline“. You will just have to check what the statements look like, and adapt the code for the tag archive to fit.
Step 3: Put up the tag cloud!
Now tags should be fully up and running on your blog, but you might also want to present the most popular tags with a fancy tag cloud in your sidebar. To do this, all you need to do is open your Sidebar template, and place this piece of code somewhere within that template:
<?php if ( function_exists(‘wp_tag_cloud’) ) : ?>
<li>
<h2>Popular Tags</h2>
<ul>
<?php wp_tag_cloud(’smallest=8&largest=22′); ?>
</ul>
</li>
<?php endif; ?>
Again, you might have to slightly modify that piece of code in order for it to fit well in with the rest of your sidebar. Just look at the attributes of the other headlines in the sidebar, are they for instance h2 with a certain class? If that is the case, then just modify the tags wrapped around “Popular Tags”.
Now all that remains to do is to tag your articles! If you have ugpraded to WordPress 2.3 already, you should see this little line below your article editor:

Have fun editing and adding tags to all your existing articles. Although hardly strictly necessary, tagging all your posts will certainly increase the purpose of actually using them in the first place!





Aaron Pepper on November 14th, 2007
1
Nice post, when the new version of Wordpress came out I had to find a post in Wordpress support for these functions. I’m surprised Wordpress didn’t add Tags sooner, it’s one of those no brainer features that should be in every Blog system.
DerekBeau on November 14th, 2007
2
Useful content and very well written. I’m sure this will help out a ton of people!
Hyder on November 14th, 2007
3
@Derek, I didn’t use them myself, Seeing as how easy it is, I might just add them to the blog.
Mike C on November 14th, 2007
4
Tags can be very important to the success of a blog.
Lars-Christian on November 15th, 2007
5
Thanks for the feedback guys. It’s nice to see that my first post here was appreciated
And Mike, while they can be a nice supplement to the traditional navigation, I don’t really think they are overly important. But, as I said, they are an excellent supplement to other forms of navigation, and a great way of drawing attention to other parts of your content. I have experienced that myself when browsing through blogs with tagging enabled