Control the Text Size of Tags in WordPress


In WordPress there is a useful widget called “Tag Cloud” to show case most used tags.

tagcloud

But we dont have any control in text size of the above widget. It looks like:

tagcloud-before

Now if you want to set a minimum text size or a maximum text size, you may add a code into theme function. After adding the code it will look like:

tagcloud-after

The necessary code which is to be added into functions.php:-

add_filter('widget_tag_cloud_args','set_number_tags');
function set_number_tags($args) {
$args = array('smallest'    => 8, 'largest'    => 16);
return $args;
}

Leave a Reply

Your email address will not be published.