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.

jblanton Written by jblanton from Success For Your Blog
Posted on January 17th, 2008 and filed under WordPress Coding & Design
Do not forget to subscribe to our RSS feed for updates
  • Digg This Post
  • Tweet This Post
  • Stumble This Post
  • Submit This Post To Delicious
  • Submit This Post To Reddit
  • Submit This Post To Mixx

14 Responses to “Implementing Tags into your WordPress blog”

Author comments are in a darker gray color for you to easily identify the posts author in the comments

  1. Spale says:

    Great post, that was just i needed.
    Can tags be shown on special page, for example as normal Archive page on WordPress blog?

  2. jblanton says:

    Thanks Spale.

    Yea you should be able to add the code to any pages in your WP Theme. Might take some trial and error to get it to show up the way you want.

  3. Is “The Loop” part of a specific file :?: I am still unfamiliar with php, but would like to learn more.

  4. Cigar Jack says:

    Now if only I had some magical tagging tool to add tags to my 400 old posts that don’t have any.

  5. Guillermo says:

    Great, great post! I’ve been wainting for such a good explanation of WP tags for a long time!

    Thanks!

  6. jblanton says:

    @not John Chow – The loop is the part of the WordPress code that displays your posts. Its usually included in the index.php and single.php pages of your theme at a minimum. Take a look at the Link in this post title The Loop that takes you to the WordPress documentation. Hope that helps.

    @Cigar Jack I feel your pain. Pull a nice Maduro out, that should help ease the pain. :wink:

    @Guillermo Thanks. Hope this helped.

  7. Martin Welch says:

    Thanks for explaining more on how to implement tags in WordPress. I
    got more ideas on how to use it. :)

  8. What is the advantage of tags? Is it just so that people can find your older posts? Does tagging help with SEO?

  9. Barry O says:

    I found Simple Tags to be a great plug-in for managing tags. It has some really cool features plus, it provides a more configurable tag cloud than the standard WordPress one.

Comments are closed.

Comments are closed since this post is older than 30 days. However, you can continue this discussion in our popular Blogging Forums

Subscribe To BloggingTips Via RSS Subscribe To Blogging Tips Via Email Follow Us On Twitter Find Out More About Our Newsletter
 

Blogging Tips Sponsors

Blogging Tips Newsletter

 

Blogging Tips Sponsors

 

Latest from the Blogosphere