我怎么可能这样做?另外我如何显示其子类别?
答案 0 :(得分:7)
检查
<?php $this_category = get_category($cat); ?>
<!-- If category is parent, list it -->
<?php if ($this_category->category_parent == 0) { ?>
<?php } else { ?>
<!-- If category is not parent, list parent category -->
<?php $parent_category = get_category($this_category->category_parent); ?>
<?php } ?>