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.
[…] WP-Snipp Twitter deze […]
there anymore style possibilities within this snippet?
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