WordPress Tutorial: Tag Cloud
Tag clouds can be useful to show mentions in your blog posts, or just interesting to display on your website.
Use the following codes to insert a tag cloud of your tags in your sidebar or footer of your WordPress theme.
Displaying Tags
<?php wp_tag_cloud('number=0'); ?>
The 0 specifies that all tags will be displayed. If you have a large number of tags and want to limit the amount of tags you have, change the zero to the number of tags you want displayed.
They will be displayed in such a way that the more popular tags are in a larger text. This is what my tag cloud roughly looks like:
Changing Font Size
Often you can have the tags nicely arranged but you might not like the size they are, so you can specify how small the smallest tag will be, and how big the biggest tag will be:
<?php wp_tag_cloud('smallest=6&largest=16&'); ?>
Here, I have chosen to make the largest tag 16pt, and the smallest at 6pt. The values of the numbers will be in pt.
This is what it looks like now. Again, all tags will be displayed.
Limiting Tags AND Changing Font Size
We simply combine the two parameters if we want to have, say, just 15 tags, and have the font size we like:
<?php wp_tag_cloud('number=15, smallest=6&largest=16&'); ?>
And this is our result:
Thank you WP Recipes!


