
A poster recently asked, "How do I change the font size for the tag cloud widget? I can't find the CSS in my theme's style sheet."
The WordPress tag cloud plugin provides a visual representation of text data, used to depict post tags or categories on WordPress powered websites. This is an independent WordPress function. Themes designed for WordPress do not have CSS in their style sheets for formatting the WordPress tag cloud. The CSS for the tag cloud is built into the WordPress wp_tag_cloud() function, which is found in wp-includes/category-template.php. By design, the size of each tag is determined by how many times that particular tag has been assigned to posts. The font-size dimension is assigned to each tag at run time as inline CSS. There is no style sheet.
That being said, it is easy to change the sizes for tags using the widget_tag_cloud_args filter. There are two dimensions to change, smallest and largest. Add the following code to functions.php and set the size as you like it. The defaults are 8px for smallest and 22px for largest. In the example below, the smallest is set to 12px and the largest to 19px.
Parameters
Parameters that may be included in the above function are:
- 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 (deprecated)
- linkâview
- taxonomyâUse post tags for basis of cloud
- echoâecho the results
For further reerence, visit the wp_tag_cloud() page in the WordPress Codex: Hereâs a link to the reference: http://codex.wordpress.org/Function_Reference/wp_tag_cloud