Everyone is very excited about the up coming release of WordPress this Monday, me included. The main reason for the frenzy, well at least in my case is the new tags feature. But nobody seems to be talking to much about how to add theme to our themes.
Now there is 2 ways to add them. First in a tag cloud format with wp_tag_cloud that would work good in the side bar and the second way is with the the_tags() tag within the Loop.
First I’ll show you how to use the cloud tag because there are a lot of parameters in this one. The very basic, or default usage would be to just use:
<?php wp_tag_cloud(''); ?>
But why stop there? Here is the parameters:
So here is an example in use:
<?php if ( function_exists('wp_tag_cloud') ) : // make sure they have wordpress 2.3?><li>
<h2>Popular Tags</h2>
<ul>
<?php wp_tag_cloud('smallest=8&largest=22'); ?> </ul>
</li>
<?php endif; ?>
So in this example we are showing the tags with the default settings but we are giving the tags with the highest count a font size of 22, and the smallest count get a font size of 8
Now moving on to the_tags() this is much easer. This will display the tags displayed in the loop that belong to the post. here is the basic syntax:
<?php the_tags('before', 'separator', 'after'); ?>
So here is a basic example:
<?php the_tags('Tags:', ',', '<br />'); ?>
so your tags would show like this: Tags: tag1,tag2,tag3
In closing I would just like to point out that this is just a very basic tuttorial on the new tagging features in WordPress. You should take a moment to read more about these new features on the WordPress Codex: wp_tag_cloud & the_tags
Related posts:
[...] Meanwhile David Span talks about WordPress 2.3 & the Tag Usage [...]
[...] my post yesterday (WordPress 2.3 & Tag usage) I was asked this question: What are they really good for? Well let me first explain what the are [...]