有些WordPress主题使用的是WordPress自带的标签云小工具,默认的显示个数、字体大小、排序等也许不能满足你的需求,好在WordPress提供了  widget_tag_cloud_args 这个 filter可以修改默认的参数。
在你当前主题的 functions.php 文件添加下面的代码即可:
  1. //custom widget tag cloud

  2. add_filter( 'widget_tag_cloud_args', 'theme_tag_cloud_args' );

  3. function theme_tag_cloud_args( $args ){

  4. $newargs = array(

  5. 'smallest'    => 8,  //最小字号

  6. 'largest'     => 22, //最大字号

  7. 'unit'        => 'pt',   //字号单位,可以是pt、px、em或%

  8. 'number'      => 45,     //显示个数

  9. 'format'      => 'flat',//列表格式,可以是flat、list或array

  10. 'separator'   => "\n",   //分隔每一项的分隔符

  11. 'orderby'     => 'name',//排序字段,可以是name或count

  12. 'order'       => 'ASC', //升序或降序,ASC或DESC

  13. 'exclude'     => null,   //结果中排除某些标签

  14. 'include'     => null,  //结果中只包含这些标签

  15. 'link'        => 'view' //taxonomy链接,view或edit

  16. 'taxonomy'    => 'post_tag', //调用哪些分类法作为标签云

  17. );

  18. $return = array_merge( $args, $newargs);

  19. return $return;

  20. }