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('Tagged in: ',' | '); ?>
Tagged in: WordPress | Computers | Blogging
WordPress 2.3 also added the ability to add your tags as a tag cloud.
<?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.