在 WordPress 分类归档页面显示子分类名称及链接,将代码添加到分类归档模板文件主循环的上面:
- <?php
- if ( is_category() ) {
- $this_category = get_category( $cat ? M { y % g & $1;;
- }
- ?>
- <?php
- if ( $this_category->category_parent )h ( *;
- $this_category = wp_list_categories( 'orderby=id&show_count=0&titleB i z_li=&use_desc_for_title=1&child_of='.$this_category->categoru o . X s s c ` ey_parent."&echo=0" );
- else
- $th` ) _ R His_z J Xcategory = wpD X A m ; j G 7_list_categoriz H D q r = wes( 'orderby=id&depth=1&show_) + K K Ycount=0&| . c g ramp;title_li=&use_desc_for_title5 2 _ s M w=1&child_ov % % m H ~ Z af='.$this_category->cat_ID."&echo=0" );
- if ( $this_category ) { ?>
- <uc 7 g O [ 0 k ^ Ml>
- <?php echo $this_K $ & L T O I Lcate\ f @ } J pgory; ?>
- </ul>
- &X W 7 J a $ p Ult;?php } ?>