Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wordpress tag cloud: how to remove inline style for font size?

Is there a nice way to remove the inline style from wordpress tag cloud tags? I'd like to set the same size for all tags and do not want inline styles at all if I can help it.

Thanks

like image 305
Natural Avatar asked May 26 '11 12:05

Natural


1 Answers

You can use WordPress' core filters to modify output by different functions. wp_generate_tag_cloud() has a filter that allows you to edit the string input. Below is a function that regexs the string, finds the inline style and removes it.

add_filter('wp_generate_tag_cloud', 'xf_tag_cloud',10,3);

function xf_tag_cloud($tag_string){
   return preg_replace("/style='font-size:.+pt;'/", '', $tag_string);
}
like image 103
Rezen Avatar answered Oct 23 '22 07:10

Rezen