问题描述
我正在使用The Events Calendar的wordpress插件,并试图显示类别中的事件总数。当前正在尝试:
$args = array(
'post_type' => 'tribe_events','tax_query' => array(
array(
'taxonomy' => 'tribe_events_cat','field' => 'food',),);
$query = new WP_Query( $args );
然后使用它来显示结果:
<?PHP echo $query-> found_posts; ?>
我的输出虽然返回0。我想念什么吗?
解决方法
想通了!看起来我的第一个tax_query数组属性有点差。解决方法:
.pagination .page-link {
background: red;
color: white;
}
回显相同的查询将显示正确的帖子数。