首页 > 互聯網 > 修改WordPress标签云的字体大小与显示数量

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

2009年5月21日
浏览:887     阅读评论 发表评论

当你用WordPress写BLOG写了一段时间后会发现标签云越拉越长,有的新标签没显示出来,这该怎么办?=>修改Widgets标签云的字体大小,发现很简单,还是修改代码!

因为是修改Widgets标签云,所以目标文件依旧是wp-includeswidgets.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 (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_tag_cloud(); 修改为 wp_tag_cloud(’unit=px&smallest=11&largest=20&number=50′);即可,其中:

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

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

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

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

收藏与分享
作者: shine 分类: 互聯網 标签: ,
  1. 本文目前尚无任何评论.
  1. 本文目前尚无任何 trackbacks 和 pingbacks.
icon_mrgreen.gif icon_neutral.gif icon_twisted.gif icon_arrow.gif icon_eek.gif icon_smile.gif icon_confused.gif icon_cool.gif icon_evil.gif icon_biggrin.gif icon_idea.gif icon_redface.gif icon_razz.gif icon_rolleyes.gif icon_wink.gif icon_cry.gif icon_surprised.gif icon_lol.gif icon_mad.gif icon_sad.gif icon_exclaim.gif icon_question.gif