How to hide current breadcrumb in Woocommerce

牧云@^-^@ 提交于 2020-01-06 03:10:31

问题


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 Product Title


回答1:


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;
    }

}



回答2:


Add This CSS in Your Active theme.

.woocommerce-breadcrumb { display:none !important; }

Enjoy.!



来源:https://stackoverflow.com/questions/32247636/how-to-hide-current-breadcrumb-in-woocommerce

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!