WordPress教程

WordPress 分类归档页面显示子分类名称及链接

阿里云

WordPress 分类归档页面显示子分类名称及链接,将代码添加到分类归档模板文件主循环的上面:

  1.     <?php
  2.     	if ( is_category() ) {
  3.     		$this_category = get_category( $cat );
  4.     	}
  5.     ?>
  6.     <?php
  7.     	if ( $this_category->category_parent )
  8.     		$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" );
  9.     	else
  10.     		$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" );
  11.     	if ( $this_category ) { ?>
  12.     	<ul>
  13.     		<?php echo $this_category; ?>
  14.     	</ul>
  15.     <?php } ?>
也想出现在这里?联系我们
创客主机

WordPress 分类归档页面显示子分类名称及链接

已有 180 人购买
查看演示升级 VIP立刻购买

收藏
(0)

发表回复

热销模板

Ashade - 作品展示摄影相册WordPress汉化主题
LensNews

本站承接 WordPress / PbootCMS / DedeCMS 等
系统建站、仿站、开发、定制等业务!