简体   繁体   English

WordPress获取类别和子类别

[英]WordPress Get Category & Subcategory

I have built the breadcrumbs system, just need one thing more. 我已经建立了面包屑系统,只需要一件事。

At the moment I have the following structure: - Category - Subcategory 目前,我具有以下结构:-类别-子类别

My code is as follows: 我的代码如下:

if ( is_category() ) {

            // Category page
            echo '<li class="item-current item-cat"><span class="bread-current bread-cat">' . single_cat_title('', false) . '</span></li>';

        }

But it only shows: Home > Subcategory 但这仅显示:主页>子类别

I would like to show: Home > Category > Subcategory 我想显示:主页>类别>子类别

Can you please help? 你能帮忙吗? Thanks! 谢谢!

您可以使用“get_category_parents()”见链接点击这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM