Function: wp_tag_cloud

Usage:

<?php wp_tag_cloud( $args ); ?>

Defaults:

 <?php $args = array(
    'smallest'                  => 8, 
    'largest'                   => 22,
    'unit'                      => 'pt', 
    'number'                    => 45,  
    'format'                    => 'flat',
    'separator'                 => \"\n\",
    'orderby'                   => 'name', 
    'order'                     => 'ASC',
    'exclude'                   => null, 
    'include'                   => null, 
    'topic_count_text_callback' => default_topic_count_text,
    'link'                      => 'view', 
    'taxonomy'                  => 'post_tag', 
    'echo'                      => true ); ?>

Parameters:

smallest
(integer) (optional) The text size of the tag with the smallest count value (units given by unit parameter).

Default: 8

largest
(integer) (optional) The text size of the tag with the highest count value (units given by the unit parameter).

Default: 22

unit
(string) (optional) Unit of measure as pertains to the smallest and largest values. This can be any CSS length value, e.g. pt, px, em, %.

Default: ‘pt’

number
(integer) (optional) The number of actual tags to display in the cloud. (Use ‘0’ to display all tags.)

Default: 45

format
(string) (optional) Format of the cloud display.

  • ‘flat’ separated by whitespace defined by ‘separator’ parameter.
  • ‘list’ UL with a class of ‘wp-tag-cloud’
  • ‘array’ returns the tag cloud as an array for use in PHP

Default: flat

separator
(string) (optional) The text/space between tags.

Default: ‘\n’ (whitespace)

orderby
(string) (optional) Order of the tags.

  • ‘name’
  • ‘count’

Default: name

order
(string) (optional) Sort order.

  • ‘ASC’
  • ‘DESC’
  • ‘RAND’ tags are in a random order.

Default: ASC

exclude
(string) (null) optional

Default: None

include
(string) (null) optional

Default: None

topic_count_text_callback
(string) (optional) The function, which, given the count of the posts with that tag, returns a text for the tooltip of the tag link.

Default: default_topic_count_text

link
(string) (optional) Set link to allow edit of a particular tag.

  • ‘view’
  • ‘edit’

Default: view

taxonomy
(string or array) (optional) Taxonomy or array of taxonomies to use in generating the cloud.

  • ‘post_tag’
  • ‘category’
  • ‘link_category’
  • ‘any other registered taxonomy’
  • or array of taxonomies Note: this parameter was introduced with Version 3.1

Default: post_tag

echo
(boolean) (optional) Display the result or return it in a variable. The default is true (display the tag cloud).

  • 1 (true)
  • 0 (false)

Default: true

Leave a Comment