当前位置:首页文章笔记建站教程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 分类归档页面显示子分类名称及链接

文章链接:https://www.wuyanshuo.cn/815.html

更新时间:2022年05月26日

本站大部分内容均收集于网络!若内容若侵犯到您的权益,请发送邮件至:service@wuyanshuo.cn我们将第一时间处理! 资源所需价格并非资源售卖价格,是收集、整理、编辑详情以及本站运营的适当补贴,并且本站不提供任何免费技术支持。 所有资源仅限于参考和学习,版权归原作者所有,更多请阅读无言说网络服务协议

给TA打赏
共{{data.count}}人
人已打赏
建站教程

重置 WordPress 文章编辑界面元素默认位置

2022-5-25 23:03:51

建站教程

WordPress 菜单添加自定义选项打造超级菜单

2022-5-26 5:00:02

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索
'