Customizing WordPress Tags Cloud – A Guide

If you have already used some social networking website or you are a blogger then you definitely know what the tags are. WordPress offers Tags Cloud which can be customized the way you use it at your blog. By default WP Tag Cloud will generate limited number of tags in alphabetical order. Custom templates for tags can be made which means that you can have a full page of tags as you want it. Look at the 404 page of phpmagicbook. I have used tags to give the users some more options to browse if he gets distracted by ‘page not found error’. I was thinking to give my users all tags option to click at any one. Okay now this is just one use. You can have your own customized tags page which can contain just tags and nothing more. We explore some ways about how we can customize tags/tags template/tags page at our WordPress blog.
Default Tags Cloud
Paste the following code anywhere in your blog theme’s template files (e.g. 404 page, single post page etc.) to see default tags cloud in action:
<?php if (function_exists('wp_tag_cloud')) wp_tag_cloud(); ?>
Display All Tags
Following code will give you all the WordPress tags which you have used in your blog.
<?php if (function_exists('wp_tag_cloud')) wp_tag_cloud('number=0'); ?>
Define Custom Font Size in Tags Cloud
Following code will determine the smallest and largest size in your tags cloud.
<?php if (function_exists('wp_tag_cloud')) wp_tag_cloud('smallest=8&largest=22'); ?>
Random Ordered Tags Cloud
Following code will generate random tags cloud which will not be in alphabetical order.
<?php if (function_exists('wp_tag_cloud')) wp_tag_cloud('order=RAND'); ?>
Tags Cloud Limited in Size & Ordered by Number of Posts
Following code will generate custom font sized tags cloud ordered by post frequency under a specific tag.
<?php if (function_exists('wp_tag_cloud')) wp_tag_cloud('smallest=8&largest=22&number=30&orderby=count'); ?>
Tags Cloud Format
You can format Tags Cloud in flat (Default) format – separated by whitespace, list format and array format by using following method:
<?php if (function_exists('wp_tag_cloud')) wp_tag_cloud('format=list' ); ?>
And there is ASC (Default), DESC and RAND order for Tags display order.
Exclude and Include option to exclude and include tags and more…
Mixing Things Up
And finally with a bit of a magic you can add the bits and bytes into a full story of customized Tags Cloud for your own blog. A possible combination of code and example:
<?php if (function_exists('wp_tag_cloud')) wp_tag_cloud('smallest=8&largest=22&unit=pt&number=50&format=flat&orderby=name&order=ASC&exclude=garbagetag&include=mytag' ); ?>
Example: Browse Ajax Rain’s tags page to view the full tags option in action.
WordPress has got complete guide about how you can create custom tags cloud page template or how you can customize tags cloud at your blog in a number of ways. Give it a try.
Have your say! Do you like to customize Tags Cloud at your blog or this is not a necessary part?



Sarfraz Says:
A very very helpful and easy post about customizing tags cloud for wordpress. Thanks a ton.
Kamran Says:
Nice post. I am ready to start my new blog and creating theme myself. Want to customize it all for my needs. Can you help?
inspirate Says:
thanks,,,i need to create my blog and look beautiful…