Home / functions.php / Style the tag cloud
  • How to Style the tag cloud

    style_the_tag_cloud

    Adding this PHP code snippet to the functions.php of your wordpress theme will allow you to define style details like font-size small to large, and format of the tag cloud.

    wordpress snippet : PHP

    <>
    add_filter('widget_tag_cloud_args','style_tags');
    function style_tags($args) {
    $args = array(
         'largest'    => '10',
         'smallest'   => '10',
         'format'     => 'list',
         );
    return $args;
    }
    

    ( WordPress codex functions, hooks, in this snippet. )

    widget_tag_cloud_args, get_tag, add_filter,
  • http://twitter.com/Kortschot Paul te Kortschot

    there anymore style possibilities within this snippet?

    • http://wpsnipp.com Kevin Chard

      Hi Paul,
      Yes you have a few more options, this is a list of them all.

      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
      separator – Displays whitespace between tags
      orderby – Order the tags by name
      order – Sort the tags in ASCENDING fashion
      exclude – Exclude no tags
      include – Include all tags
      topic_count_text_callback – Uses function default_topic_count_text
      link – view
      taxonomy – Use post tags for basis of cloud
      echo – echo the results

  • Pingback: Tagcloud Wordpress aanpassen | tekortschot.nl()