可在此处找到所附帖子的数量:$term->count
.
因此,您可以执行以下操作:
$class_empty_term = \'\';
if( $term->count == 0 )
$class_empty_term = \'empty\';
$term_list .= \'<div class="\' . $class_empty_term . \' grid__item ...">\';
$term_list .= \'<div class="panel text--center">\';