WordPress V3.xTemplate Tag Reference Guide as of Version 3.x
Presented by:
Tag Tags
Single Tag Titlesingle_tag_title();
Displays or returns the tag title for the current page.
<?php single_tag_title($prefix, $display); ?>
$prefix
String • Default: none
(Optional) Text to output before the title.
$display
Boolean • Default: true
(Optional) Display the title (true), or return the title to be used in PHP (false).
Tag Descriptiontag_description();
Returns the description of a tag. A tag ID can be passed as a parameter, but if no tag ID is passed, the description current queried tag will be returned.
<?php tag_description($tagID); ?>
$tagID
String • Default: return description of current query tag
(Optional) The ID of the tag to return a description.
The Tagsthe_tags();
This template tag displays a link to the tag or tags a post belongs to. If no tags are associated with the current entry, the associated category is displayed instead. This tag should be used within The Loop.
<?php the_tags($before, $separator, $after); ?>
$before
String • Default: 'tags'
Text to display before the actual tags are displayed.
$separator
String • Default: ','
Text or character to display between each tag link.
$after
String • Default: displays nothing
Text to display after the last tag.
WP Generate Tag Cloudwp_generate_tag_cloud();
Generates a tag cloud (heatmap) from provided data. The text size is set by the 'smallest' and 'largest' arguments, which will use the 'unit' argument value for the CSS text size unit. The 'format' argument can be 'flat' (default), 'list', or 'array'. The flat value for the 'format' argument will separate tags with spaces. The list value for the 'format' argument will format the tags in a UL HTML list. The array value for the 'format' argument will return in PHP array type format.
$args = array( | ||||
'smallest' | => | 8, | ||
'largest' | => | 22, | ||
'unit' | => | 'pt', | ||
'number' | => | 0, | ||
'format' | => | 'flat', | ||
'separator' | => | '\n', | ||
'orderby' | => | 'name', | ||
'order' | => | 'ASC', | ||
'topic_count_text_callback' | => | 'default_topic_count_text', | ||
'topic_count_scale_callback' | => | 'default_topic_count_scale', | ||
'filter' | => | 1 | ||
); |
<?php wp_generate_tag_cloud($tags, $args); ?>
$tags
Array • Default: none
List of tags.
$args
Array • Default: none
See above.
WP Tag Cloudwp_tag_cloud();
The wp_tag_cloud() function displays a list of tags in what is called a 'tag cloud', where the size of each tag is determined by how many times that particular tag has been assigned to posts. Beginning with Version 2.8, the taxonomy parameter was added so that any taxonony could be used as the basis of generating the cloud. That means that a cloud for Categories or any other Custom Taxonomies can be presented to visitors. Arguments are passed in as either an array or a query string.
$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 | ||
); |
<?php wp_tag_cloud($args); ?>
smallest
Integer • Default: 8
(Optional) The text size of the tag with the smallest count value (units given by unit parameter).
largest
Integer • Default: 'pt'
(Optional) The text size of the tag with the highest count value (units given by the unit parameter).
unit
String • Default: 22
(Optional) Unit of measure as pertains to the smallest and largest values. This can be any CSS length value, e.g. pt, px, em, %.
number
Integer • Default: 45
(Optional) The number of actual tags to display in the cloud. (Use '0' to display all tags.)
format
String • Default: 'flat'
(Optional) Format of the cloud display. Values and their meanings: '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.
separator
String • Default: 22
(Optional) The text/space between tags.
orderby
String • Default: 'name'
(Optional) Order of the tags. Possible values: 'name' and 'count'.
order
String • Default: 'ASC'
(Optional) Sort order. Values: 'ASC', 'DESC', 'RAND' tags are in a random order.
exclude
String • Default: null
(Optional) Tags to exclude. Default excludes none.
include
String • Default: null
(Optional) Tags to include. Default includes all.
topic_count_text_callback
String • Default: 'default_topic_count_text'
(Optional) The function, which, given the count of the posts with that tag, returns a text for the tooltip of the tag link.
link
String • Default: 'view'
(Optional) Set link to allow edit of a particular tag. Values: 'view', 'edit'.
taxonomy
String or Array • Default: 'post_tag'
(Optional) Taxonomy or array of taxonomies to use in generating the cloud. Values: 'post_tag', 'category', 'link_category', 'any other registered taxonomy', or array of taxonomies
echo
Boolean • Default: true
(Optional) Display the result (true) or return it in a variable (false).