<?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添加了默认参数。如果你需要显示显示某个暂时还没有内容的分类目录链接,可以使用这段代码。