我的知识记录

如何调用wordpress的父分类和归档页以及子分类名称和链接函数

调用wordpress的父分类和归档页以及子分类名称和链接函数代码如下:

<?php if ( is_category() ) { $this_category=g et_category( $cat ); } ?>
<?php if ( $this_category->category_parent )
$this_category = wp_list_categories( ‘orderby=id&show_count=0&title_li=&use_desc_for_title=1&child_of=’.$this_category->category_parent.”&echo=0″ );
else $this_category = wp_list_categories( ‘orderby=id&depth=1&show_count=0&title_li=&use_desc_for_title=1&child_of=’.$this_category->cat_ID.”&echo=0″ );
if ( $this_category ) { ?>

    <?php echo $this_category; ?>

<?php } ?>

如何调用wordpress的父分类和归档页以及子分类名称和链接函数

标签:

更新时间:2026-01-06 18:51:58

上一篇:wordpress如何调用栏目中最新文章

下一篇:WordPress主题二次开发时常用到的函数