//custom widget tag cloud
add_filter( 'widget_tag_cloud_args', 'theme_tag_cloud_args' );
function theme_tag_cloud_args( $args ){
$newargs = array(
'smallest' => 8, //最小字号
'largest' => 22, //最大字号
'unit' => 'pt', //字号单位,可以是pt、px、em或%
'number' => 45, //显示个数
'format' => 'flat',//列表格式,可以是flat、list或array
'separator' => "\n", //分隔每一项的分隔符
'orderby' => 'name',//排序字段,可以是name或count
'order' => 'ASC', //升序或降序,ASC或DESC
'exclude' => null, //结果中排除某些标签
'include' => null, //结果中只包含这些标签
'link' => 'view' //taxonomy链接,view或edit
'taxonomy' => 'post_tag', //调用哪些分类法作为标签云
);
$return = array_merge( $args, $newargs);
return $return;
}
如何修改WordPress自带标签云小工具的显示参数
原创
©著作权归作者所有:来自51CTO博客作者jxlazzw的原创作品,请联系作者获取转载授权,否则将追究法律责任
有些WordPress主题使用的是WordPress自带的标签云小工具,默认的显示个数、字体大小、排序等也许不能满足你的需求,好在WordPress提供了 widget_tag_cloud_args 这个 filter可以修改默认的参数。
在你当前主题的 functions.php 文件添加下面的代码即可:
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
wp/wordpress系统自带小工具屏蔽
在functions.php添加:function unregister_rss_widget(){ unregister_widget('WP_Wi...
php wordpress linux python hive -
wp/wordpress如何注册页面侧栏,并在小工具里面显示
昨天发了一篇不同页面调用不同侧栏小工具的方法,《wp/wordpress调
python java php vue wordpress