猫窝私语 — Makumo's Blog

玛酷猫的温馨小窝,记录生活点点滴滴。

@玛酷猫10年前

11/29
23:42
WordPress

wordpress自带标签云设置

总觉得标签云有些怪怪的,感觉使用标签不止这么多,而且最大的字体有些大了。于是乎发动懒猫精神上网搜索了下,这一刻搜索引擎是强大的 😀

在[name]Slyar,http://www.slyar.com/blog/[/name]的blog上看到相关的一篇文章[name]修改WordPress标签云的字体大小以及显示数量,http://www.slyar.com/blog/tag-cloud-font.html[/name]介绍到标签云的一系列参数,顺便也转录过来了:

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 (i.e. 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”.

把参数值写入wp-includeswidgets.php中的wp_tag_cloud()函数中即可,例如:

wp_tag_cloud('unit=px&smallest=12&largest=20&number=50&orderby=count');

即把标签云设置成最大字体20像素,最小字体12像素,显示数目50,按照使用次数排序

wordpress自带标签云设置