Tag options for WordPress 2.3
Starting with version 2.3, WordPress now includes the option to add tags to your posts. This included function works similar to the all popular UTW Ultimate Tag Warrior tag plugin with the exception that it's already pre-configured and included with WordPress 2.3. In the following tutorial, I'll cover how to benefit from the new WordPress 2.3 tagging option by adding the tags to your custom template. Note: if your looking for an All-In-One solution, my streamliner template includes the tagging option and is compatible with WordPress 2.3 as well.
Adding tags to your WordPress posts:
When you go to write a post using WordPress 2.3, your now presented with a tags entry box as seen below:
Simply add the keyword tags you feel relate the best to the content of your post and save your post.
As you continue to populate your blog with posts containing keyword tags, some posts will likely share the same tags. WordPress 2.3 will automatically group posts that share the same tags. Clicking on a keyword tag listed within a post will send the visitor to a listing of posts related to the same tag.
Adding tags to your WordPress templates:
If your using a theme that was created previous to WordPress version 2.3, you'll need to add the new tag call in to your theme. Specifically to the single.php file. Here is how:
- Login to your WordPress admin panel and navigate to Presentation > Theme Editor
- Find your single.php (single post) from the list of theme files and click to open
- Preferably after the following section:
<?php the_content(); ?>
- Add the following line to your single post template:
<?php the_tags( '<p>Tags: ', ', ', '</p>'); ?>
- Click Update File and go view a post on your site. You should now see a Tags: list similar to that shown below:
When you click on a tag it should take you to a page of related posts that share the same tag.
Other tag Options:
Here is another tag example that would produce a sized tag cloud list (for use in a sidebar?):
<?php if ( function_exists('wp_tag_cloud') ) : ?>
<?php wp_tag_cloud('smallest=8&largest=20'); ?>
<?php endif; ?>
Or to produce a sized tag cloud (for use in footer?) use:
<?php wp_tag_cloud('smallest=8&largest=20&number=30&orderby=count'); ?>