Replacing the home link in woocommerce breadcrumbs

妖精的绣舞 提交于 2019-12-04 02:31:22

问题


I know its a bit of a daft question, but like a fool I just cant find the right answer.

At the moment this is what my breadcrumbs look like

Home / Male Voice overs / Derek Doyle

I need to change the home link name to Voice Overs and link it to another page.

Please any help would be great.

Thanks


回答1:


Woocommerce provides filters for this.

add_filter( 'woocommerce_breadcrumb_defaults', 'jk_change_breadcrumb_home_text' );
function jk_change_breadcrumb_home_text( $defaults ) {
    // Change the breadcrumb home text from 'Home' to 'Voice Overs'
    $defaults['home'] = 'Voice Overs';
    return $defaults;
}

add_filter( 'woocommerce_breadcrumb_home_url', 'woo_custom_breadrumb_home_url' );
function woo_custom_breadrumb_home_url() {
    return 'http://yoursite.com/voice-overs';
}

Use these filters in your functions.php file to get the desired results.

https://docs.woocommerce.com/document/customise-the-woocommerce-breadcrumb/



来源:https://stackoverflow.com/questions/45851779/replacing-the-home-link-in-woocommerce-breadcrumbs

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