Modifying the WordPress Tag Cloud Widget Font Size
by c.bavota | Posted in Tutorials | 18 comments
Using WordPress widgets for your sidebar really makes things easy on programmers and especially on users. The only problem I have come across is customizing the widgets so that they work exactly how you need and look the best for your specific design.
I needed to manipulate the Tag Cloud widget so that the size of the largest font was not too big. It only took going in and changing one line in the widgets.php files. I wouldn’t suggest doing this unless you are somewhat comfortable with messing around with your code.
File to manipulate: wp-includes/widgets.php
Find:
wp_tag_cloud(); // at around line 1372
Change to:
wp_tag_cloud('smallest=10&largest=14&number=25&orderby=name');
“smallest” is the size of the smallest font you want
“largest” is the size of the largest font you want
“number” is the amount of tags you want to appear
“orderby” is how the orders of the tags will be shown



Oh yeah. After hours spent around to find a clue to resize the font of the tag cloud, finally an answer!
Let me say: THE answer!
Bookmarked your website
Thanks
Thanks a million. I read there was no way to change the number of tags nor the size of them. I am very grateful that you shared this solution. Namaste.
Finally I have found this to modify my tag cloud! thanks again man!
Very usefull!! Thanks! Does anybody know how and where to change the Font of an Widget? For example in the Tag Cloud?
Better would be to place the following in the functions.php
add_filter( ‘widget_tag_cloud_args’, my_tag_cloud_args );
function my_tag_cloud_args($in){
return ‘smallest=11&largest=11&number=25&orderby=name&unit=px’;
}
Thanks! This is best way!
Grazie!
Thanks so much, this is exactly what I was looking for!
Thanks Klaus
I was looking for something theme specific and add_filter is perfect.
i cant see it under that file.
any idea?
yes, don’t see it also. why is that all font size are all the same? i already specify the smallest and largest size.
my problem solved. the problem is the post tag count.
Thanks for sharing Bavota!
Is it possible to get define a some functions using add_filter or add_action from functions.php file in theme directory , instead of editing widgets.php?
Thanks in advance
I know there are some plugins out there that do this, so they probably have the code you would need to figure this one out.
In new wordpress 3.0.1 if you want to change font size in tag cloud you need to manipulate “wp-includes/category-template.php”
In line 562 just change the numbers for smallest and largest sizes.
Hope it helps
I, not long ago came throughout this site and also have enjoyed the content. I look forward to long term content and can definitely hyperlink to this and tell the folks I understand. Thank you.
I really hate going into those files but I guess if this is the only way to change the font size of the tags, I guess I will try it.
I have been looking around for a while for this information and not really much out there. Thanks for the help.
Nice little wordpress hack – will definitely come in handy. I always used to be careful on which tag name I gave to certain posts lol.