Skip to content

Wordpress theme: changing tag cloud font size

by Cesar on December 18th, 2009

This solution works for WordPress 2.8.3

I’m busy building this beautiful Wordpress theme. Added a sidebar, put a widget in there with the tag cloud. But what happens? The tags that appear most often are largest. This font size can’t easily be adjusted, but I’ve done some researching and came up with this:
Open up the file wp-includes/category-template.php and search for ‘wp_tag_cloud’, you’ll see this:

function wp_tag_cloud( $args = '' ) {
$defaults = array(
'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45,
'format' => 'flat', 'orderby' => 'name', 'order' => 'ASC',
'exclude' => '', 'include' => '', 'link' => 'view', 'taxonomy' => 'post_tag', 'echo' => true
);

Change the values behind ’smallest’ and ‘largest’ to whatever you like and you’ll see that the theme will display the tag cloud the way you envisaged. See wordpress.org for instructions on other parameter. One problem with this is that the changes aren’t made to the theme, but to the wordpress installation. There’s hope that future releases let you change these options from within the dashboard.

From → Programming

No comments yet

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS