1 2 3 4 5 6 7 8 9 |
<?php $category = get_the_category(); $parent = get_cat_name($category[0]->category_parent); if (!emptyempty($parent)) { echo $parent; } else { echo $category[0]->cat_name; } ?> |
通过函数 get_categories() 就可以
把以下代码调整后添加到主题的category.ph
一、在functions中加入: [crayon-