wp_tag_cloud() – WordPress 2.3

Small Potato covered one of the new tag functions that will be appearing in WordPress 2.3 – <?php the_tags(); ?>. I was pleased to find, though, that the WordPress development team had included the new tag cloud function, as well, since I currently use UTW’s tag cloud as an enhanced site index.

The documentation on <?php wp_tag_cloud(); ?> is currently incomplete, so I had to do some digging into the core code to find out how to adjust the parameters. <?php wp_tag_cloud(); ?> takes a string of parameters that adjust how your tag cloud displays. For example, <?php wp_tag_cloud('number=20&order=desc'); ?> will display a tag cloud of your top 20 tags and sort them in descending order.

Here are the various settings:

* smallest – Adjusts the size of the smallest tags in the cloud. Default is ‘8’.
* largest – Adjusts the size of the biggest tags in the cloud. Default is ’22’.
* unit – Sets the unit type for font size (i.e. point or em). Default is ‘pt’.
* number – How many tags will display in the cloud. Default is ’45’.
* format – ‘Flat’ displays an inline cloud with each term separated by whitespace. ‘List’ generates an unordered list. ‘Array’ lets you define an array of tags. Default is ‘flat’.
* orderby – Sort the cloud by ‘name’ or ‘count’. Default is ‘name’.
* order – Sort the cloud in ascending or descending order. Default is ‘ASC’.

The new native taxonomy isn’t as powerful as UTW was, but I’m sure it won’t be too long before there will be a host of new plugins to change that.

WordPress 2.3 Beta 2 releases on Monday. I’ll write about any new changes somewhere around then.

Have anything to add to the conversation?