WordPress:文章页(single.php)获取当前文章所属分类的所有子分类
<?php
// 获取当前文章所属分类的所有子分类
if(is_single()||is_category()) { //如果是文件页面或分类页
if(get_category_children(get_category_root_id(the_category_ID(false)))!= "" ) {//如果有子分类
echo '<ul>';
echo wp_list_categories("child_of=".get_category_root_id(the_category_ID(false)). "&depth=0&hide_empty=0&title_li=&orderby=id&order=ASC");
echo '</ul>';
}
}
?>