Skip to content

Instantly share code, notes, and snippets.

@hzlzh
Created August 19, 2012 15:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hzlzh/3395431 to your computer and use it in GitHub Desktop.
Save hzlzh/3395431 to your computer and use it in GitHub Desktop.
Customize the WordPress Tag Cloud Widget
<?php
// the hook to custom tag widget, put in you `functions.php`
function my_tag_cloud_filter($args = array()) {
$args['smallest'] = 12; //最小字号
$args['largest'] = 12; //最大字号
$args['unit'] = 'px'; //字体单位 px,pt,em
$args['number'] = 20; //调用数量
$args['orderby'] = 'count'; //按何值排序
$args['order'] = 'RAND'; //排序方式
// for more check here: http://codex.wordpress.org/Function_Reference/wp_tag_cloud
return $args;
}
add_filter('widget_tag_cloud_args', 'my_tag_cloud_filter', 10);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment