Implementing Tags into your WordPress blog

A tag is a keyword used to describe a picture, video, blog entry, or anything else to help with classification and search information.

In the release of WordPress 2.3 tagging was officially introduced into the core WordPress application. Prior to this implementation many of us used plug-ins like Ultimate Tag Warrior, Jerome’s Keywords, Simple Tags and Bunny’s Technorati Tags. Since the release of WordPress 2.3 many if not all of these plug-ins have now been upgraded and work with WordPress 2.3 and later. So if you’re using them and like them you can still use them.

Now for those of you that have not used Tags in the past and would like to take advantage of WordPress’ new feature let’s get started. The first thing you will notice is in the write a new post section within WordPress called tags. It’s the 1 line form field under the post box. Just type your tags separated with a comma after each. OK now we have the easy part done. Don’t worry the next part isn’t much harder.

Now that you have your post tagged you want the tags to show up on your blog. Chances are your blog template wasn’t built with the php to display the tags. The good news this is really easy to correct. To start lets go to the theme editor in WordPress and look for The Loop. Keeping it very basic, insert this code: <?php the_tags(); ?> before or after <?php the_content(); ?>. That should display the tags on your page either just before or just after the post body. Once you see it in action you can play around with moving it around to get the tags to show up exactly where you want them.

Below is that basic usage code to help explain it a little better.

<?php the_tags(‘before’, ’separator’, ‘after’); ?>

Let’s take a look at some other examples you can use:


<?php the_tags('Tagged with: ',' • ','<br />'); ?>

Tagged with: WordPress • Computers • Blogging


<?php the_tags('<ul><li>','</li><li>','</li></ul>');?>

• WordPress
• Computers
• Blogging


<?php the_tags('Tagged in: ',' | '); ?>

Tagged in: WordPress | Computers | Blogging

WordPress 2.3 also added the ability to add your tags as a tag cloud.

Use this <?php wp_tag_cloud(’smallest=8&largest=36&′);   ?> The number of words displayed this way will be a max of 45 but you can change that by using this code. <?php wp_tag_cloud(’smallest=8&largest=36&number=150′);   ?> By changing the number= the tag cloud will display that number of tags if you have that many.

Disclosure: In full disclosure, it is safe to assume that the site owner is benefiting financially or otherwise from everything you click on, read, or look at while on my website. This is not to say that is the case with all content, as all publications on the site are original and written to provide value and references to our audience.

9 Comments

  1. Spale January 17, 2008
  2. jblanton January 17, 2008
  3. Not John Chow January 17, 2008
  4. Cigar Jack January 17, 2008
  5. Guillermo January 17, 2008
  6. jblanton January 17, 2008
  7. Martin Welch January 17, 2008
  8. Ping Golf Clubs January 18, 2008
  9. Barry O January 18, 2008