显示 html 链接上的类别计数


Showing Category Count on Html Links

我的wordpress网站侧边栏上有html链接,我想显示与该链接相关的帖子数量。

这些帖子被放置在由以下功能定义的自定义列表类别下:

菲律宾语:

function va_cat_menu_drop_down( $location = 'menu', $taxonomy ) {
global $va_options;
$key = 'categories_' . $location;
$options = $va_options->$key;
$args['menu_cols'] = ( $location == 'menu' ? 3 : 2 );
$args['menu_depth'] = $options['depth'];
$args['menu_sub_num'] = $options['sub_num'];
$args['cat_parent_count'] = $options['count'];
$args['cat_child_count'] = $options['count'];
$args['cat_hide_empty'] = $options['hide_empty'];
$args['cat_nocatstext'] = true;
$args['cat_order'] = 'ASC';
$args['taxonomy'] = $taxonomy;
$terms_args['pad_counts'] = false;
$terms_args['app_pad_counts'] = true;
return va_categories_list($args, $terms_args);
}

我如何在我的 Html 链接旁边显示特定类别中的帖子数量,因为以下内容不起作用(我想因为列表类别可能是自定义分类法?

<?php echo get_category(17)->count; ?>

有一个非常简单的方法可以做到这一点。使用wp_list_categories并输入参数"show_count"=> 1

http://codex.wordpress.org/Template_Tags/wp_list_categories