加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > CMS系统 > wordpress > 正文

让WordPress“分类目录”工具显示空分类

发布时间:2020-12-14 14:15:03 所属栏目:wordpress 来源:网络整理
导读:?php add_filter( 'widget_categories_args','mytheme_widget_cat_args' ); function mytheme_widget_cat_args($cat_args) { // the default for hide_empty = 1,so $cat_args['hide_empty'] = 0; // we can override any other defaults here too return $c

<?php
add_filter( 'widget_categories_args','mytheme_widget_cat_args' );
function mytheme_widget_cat_args($cat_args) {
// the default for "hide_empty" = 1,so
$cat_args['hide_empty'] = 0;
// we can override any other defaults here too
return $cat_args;
}
?>

在WordPress博客前端显示“分类目录”widget工具时,系统会调用wp_list_categories标签。而上面这段代码利用过滤器(filter)为wp_list_categories添加了默认参数。如果你需要显示显示某个暂时还没有内容的分类目录链接,可以使用这段代码。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读