X

Style the Tag Cloud

Snippets by IsItWP

Do you want to define style details like font size and format of the tag cloud? While there’s probably a plugin for this, we have created a quick code snippet that you can use to style the tag cloud in WordPress.

Instructions:

All you have to do is add this code to your theme’s functions.php file or in a site-specific plugin:

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

Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly add code snippets in WordPress, so you don’t accidentally break your site.

If you liked this code snippet, please consider checking out our other articles on the site like: 12 best WordPress plugins for bloggers and 27 best WordPress themes for travel blogs.

Comments  Leave a Reply

  1. Tagcloud Wordpress aanpassen | tekortschot.nl March 31, 2011 at 5:30 am

    […] WP-Snipp Twitter deze […]

  2. Paul te Kortschot March 29, 2011 at 7:35 am

    there anymore style possibilities within this snippet?

    1. 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

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!
[63% OFF Today!]
[63% OFF Today!]
[63% OFF Today!]
[63% OFF Today!]
[63% OFF Today!]
[63% OFF Today!]
[60% OFF Today!]
[60% OFF Today!]
[50% OFF Today!]
[50% OFF Today!]