如何在Woocommerce中隐藏当前的面包屑 [英] How to hide current breadcrumb in Woocommerce

查看:193
本文介绍了如何在Woocommerce中隐藏当前的面包屑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

产品页面和产品标题的正下方有面包屑。一行太多了,我想这样隐藏当前的碎屑:

There is breadcrumbs on product page and product title just below them. It's too much for one line and I want to hide current crumb like this:


Home-> Catalog-> Category-> Subcategory->

H1产品标题

Home->Catalog->Category->Subcategory->
H1 Product Title


推荐答案

我在woocommerce / templates /中找到了global / breadcrumb.php部分为$ crumb。全部是一个链接,但最后是一个简单的文本。

I found in woocommerce/templates/global/breadcrumb.php the part for $crumb. All is a link, but last is a simple text.

foreach ( $breadcrumb as $key => $crumb ) {

    echo $before;

    if ( ! empty( $crumb[1] ) && sizeof( $breadcrumb ) !== $key + 1 ) {
        echo '<a href="' . esc_url( $crumb[1] ) . '">' . esc_html( $crumb[0] ) . '</a>';
    } else {
        echo esc_html( $crumb[0] ); // Just replace $crumb here for empty ''
    }

    echo $after;

    if ( sizeof( $breadcrumb ) !== $key + 1 ) {
        echo $delimiter;
    }

}

这篇关于如何在Woocommerce中隐藏当前的面包屑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆