Table of Contents

It is possible to add the Terms Display output directly into your site’s PHP files.

The best approach is to use the PHP to include the shortcode inside a PHP snippet, as in this example below.

<?php echo do_shortcode("[taxopress_termsdisplay id="1"]"); ?>

Legacy PHP Code #

There is also a legacy option allows you to make choices directly in the PHP code. This is the basic code snippet:

<?php st_tag_cloud(); ?>

Here are examples of how you can customize that basic code with more details:

'size' => 'true',
'smallest' => 8,
'largest' => 22,
'unit' => 'pt',
'color' => 'true',
'maxcolor' => '#000000',
'mincolor' => '#CCCCCC',
'number' => 45,
'format' => 'flat',
'cloud_selection' => 'count-desc',
'cloud_sort' => 'random',
'exclude' => '',
'include' => '',
'limit_days' => 0,
'min_usage' => 0,
'notagstext' => __('No tags.', 'simpletags'),
'xformat' => __('<a href="%tag_link%" class="tag-link-%tag_id%" title="%tag_count% topics" %tag_rel% style="%tag_size% %tag_color%">%tag_name%</a>', 'simpletags'),
'title' => __('<h4>Tag Cloud</h4>', 'simpletags'),
'category' => 0,
'taxonomy' => 'post_tag

Here is an example of that legacy code in use. In this code, we display randomly the top 100 tags. The max width will be 45px and the min is 12px. The color used for max tags will be red (#FF0000) and for min tags green (#00FF0B).

<?php st_tag_cloud('cloud_selection=count-desc&cloud_sort=random&number=100&title=Mon nuage de tags&largest=45&smallest=12&unit=px&maxcolor=#FF0000&mincolor=#00FF0B'); ?

Here are all the legacy code parameters:

  • size
    • (boolean) Active or not dynamic font size generation
  • smallest
    • (integer) Length of the font to use to show the less used tags
  • largest
    • (integer) Length of the font to use to show the most used tags
  • unit
    • (string) Measuring unit of the used font for smallest and largest parameters. Use pt for point
  • color
    • (boolean) Active or not dynamic color generation. true/false
  • maxcolor
    • (string) Used color for most popular tags
  • mincolor
    • (string) Used color for less popular tags
  • number
    • (integer) Number of tags to show inside the tags cloud (Use ‘0’ to show all of them)
  • format
    • (string) Tag’s format of posting
      • flat – (Default) Tags are separated by spaces
      • list – tags are inside a non ordered list (UL) containing class=’st-tag-cloud’
      • array – tags are inside a PHP array (use it with st_get_tag_cloud())
  • cloud_selection
    • (string) Tags selection order. Valid values are :
      • count-desc – (default) by number of usage tags (most popular)
      • count-asc – by number of usage tags (least used)
      • name-asc – by tag name ascending
      • name-desc – by tag name descending
      • random – random
  • cloud_sort
    • (string) Tags selection order. Valid values are :
      • count-desc – by number of usage tags (most popular)
      • count-asc – by number of usage tags (least used)
      • name-asc – by tag name ascending
      • name-desc – by tag name descending
      • random – (default) random
  • exclude
    • (string) list of tags to exclude, separated by commas (term_id). For example ‘exclude=5,27’ means all tags which contain term_id 5 or 27 will be NOT shown. By default, any tag is excluded.
  • include
    • (string) list of tags to include, separated by commas (term_id). For example ‘exclude=5,27’ means all tags which contain term_id 5 or 27 will be the alone tags to be shown. By default, all tags are included
  • limit_days
    • (integer) Number of days to be considered to generated tag cloud.
  • min_usage
    • (integer) Min number of tag counter for display it into tag cloud
  • notagstext
    • (string) Text to show, if there is no tag.
  • xformat
    • (string) Extended format of links. You can personalize the formating of tag’s link. Available markups :
      • tag_link – Replaced by the permalink of the tag
      • tag_feed – Replaced by the RSS tag link
      • tag_id – Replaced by the tag ID
      • tag_count – Replaced by the use number (counter) of the tag
      • tag_size – Replaced by the size of the tag (creates : font-size:17pt;)
      • tag_color – Replaced by the color of the tag (creates : color:#666666;)
      • tag_name – Replaced by the tag’s name
      • tag_name_attribute – Replaced by the tag’s name, formatted for attribute HTML
      • tag_rel – Replaced by rel tag markup (creates : rel=”tag”)
      • tag_scale – Replaced by tag scale (between 1 and 10)
      • tag_technorati – Replaced by Technorati tag link
      • tag_flickr – Replaced by Flickr tag link
      • tag_delicious – Replaced by Del.ici.ous tag link
  • title
    • (string) Specify the positioned title shown before tags cloud
  • category
    • (string) Restrict tag cloud to a specific category. (or more, separated with comma)
  • taxonomy
    • (string) Select taxonomy to used for tag cloud