WordPress企业主题定制/开发/优化

修改WordPress标签云的字体大小和显示数量

首页 » WORDPRESS主题技术 » 修改WordPress标签云的字体大小和显示数量

原文章的链接

转载过来是为了方面自己以后更改使用,毕竟WP还是经常升级的。

wp-includes/category-template.php,打开并搜索wp_tag_cloud,这个就是标签云的调用函数了,查了一下参数表,得到wp_tag_cloud函数的参数如下:

smallest – Adjusts the size of the smallest tags in the cloud. Default is “8″.
largest – Adjusts the size of the biggest tags in the cloud. Default is “22″.
unit – Sets the unit type for font size (ie point or em). Default is “pt”.
number – How many tags will display in the cloud. Default is “45″.
format – “Flat” displays an inline cloud with each term separated by whitespace. “List” generates an unordered list. “Array” lets you define an array of tags. Default is “flat”.
orderby – Sort the cloud by “name” or “count”. Default is “name”.
order – Sort the cloud in ascending or descending order. Default is “ASC”.

对照修改即可,其中:

unit=是字体大小的单位,使用我们熟悉的px最好;

smallest=是指最小字体大小,自己修改;

largest=是指最大字体大小,自己修改。

还可以使用number=来设置标签的显示数量,orderby=来使得标签云按照标签的使用次数来排列等等。

相关项目

  • WordPress外贸企业主题

  • 最近更新

  • 热门标签