WordPress 2.8 Template Tags/wp tag cloud

Usage

Default Usage
‘smallest’ => 8,
‘largest’ => 22,
‘unit’ => ‘pt’,
‘number’ => 45,
‘format’ => ‘flat’,
‘orderby’ => ‘name’,
‘order’ => ‘ASC’,
‘exclude’ => ,
‘include’ => ,
‘link’ => ‘view’,
‘taxonomy’ => ‘post_tag’,
‘echo’ => true ); ?>

By default, the usage shows:

smallest – The smallest tag (lowest count) is shown at size 8
largest – The largest tag (highest count) is shown at size 22
unit – Describes ‘pt’ (point) as the font-size unit for the smallest and largest values
number – Displays at most 45 tags
format – Displays the tags in flat (separated by whitespace) style
orderby – Order the tags by name
order – Sort the tags in ASCENDING fashion
exclude – Exclude no tags
include – Include all tags
link – view
taxonomy – Use post tags for basis of cloud
echo – echo the results
Parameters
smallest
(integer) The text size of the tag with the smallest count value (units given by unit parameter).
largest
(integer) The text size of the tag with the highest count value (units given by the unit parameter).
unit
(string) Unit of measure as pertains to the smallest and largest values. This can be any CSS length value, e.g. pt, px, em, %; default is pt (points).
number
(integer) The number of actual tags to display in the cloud. (Use ‘0’ to display all tags.)
format
(string) Format of the cloud display.
‘flat’ (Default) tags are separated by whitespace
‘list’ tags are in UL with a class=’wp-tag-cloud’
‘array’ tags are in an array and function returns the tag cloud as an array for use in PHP Note: the array returned, rather than displayed, was instituted with Version 2.5.
orderby
(string) Order of the tags. Valid values:
‘name’ (Default)
‘count’
order
(string) Sort order. Valid values – Must be Uppercase:
‘ASC’ (Default)
‘DESC’
‘RAND’ tags are in a random order. Note: this parameter was introduced with Version 2.5.
exclude
(string) Comma separated list of tags (term_id) to exclude. For example, ‘exclude=5,27’ means tags that have the term_id 5 or 27 will NOT be displayed. Defaults to exclude nothing.
include
(string) Comma separated list of tags (term_id) to include. For example, ‘include=5,27’ means tags that have the term_id 5 or 27 will be the only tags displayed. Defaults to include everything.
link
(string) Set link to allow edit of a particular tag. Note: this parameter was introduced with Version 2.7. Valid values:
‘view’ (Default)
‘edit’
taxonomy
(string) Taxonomy to use in generating the cloud. Note: this parameter was introduced with Version 2.8.
‘post_tag’ – (Default) Post tags are used as source of cloud
‘category’ – Post categories are used to generate cloud
‘link_category’ – Link categories are used to generate cloud
echo
(boolean) Show the result or keep it in a variable. The default is true (display the tag cloud). Note: this parameter was introduced with Version 2.8. Valid values:
1 (true) – default
0 (false)

Examples
Cloud displayed under Popular Tags title

  • Popular Tags


  • Cloud limited in size and ordered by count rather than name

    Cloud returned as array but not displayed
    The variable $tag will contain the tag cloud for use in other PHP code

    King Php Science Welcome, you are from: 54.198.143.223