This is a Developer level doc. If you are unfamiliar with code/templates and resolving potential conflicts, select a WooExpert or Developer for assistance. We are unable to provide support for customizations under our Support Policy.
functions.php
file or via a plugin that allows custom functions to be added, such as the Code snippets plugin. Please don’t add custom code directly to your parent theme’s functions.php
file as this will be wiped entirely when you update the theme.
Change the ‘Home’ text
↑ Back to topadd_filter( 'woocommerce_breadcrumb_defaults', 'wcc_change_breadcrumb_home_text', 20 );
Change the breadcrumb separator
↑ Back to topadd_filter( 'woocommerce_breadcrumb_defaults', 'wcc_change_breadcrumb_delimiter', 20 );
Change all the things
↑ Back to top
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Change several of the breadcrumb defaults | |
*/ | |
add_filter( 'woocommerce_breadcrumb_defaults', 'jk_woocommerce_breadcrumbs' ); | |
function jk_woocommerce_breadcrumbs() { | |
return array( | |
'delimiter' => ' / ', | |
'wrap_before' => '<nav class="woocommerce-breadcrumb" itemprop="breadcrumb">', | |
'wrap_after' => '</nav>', | |
'before' => '', | |
'after' => '', | |
'home' => _x( 'Home', 'breadcrumb', 'woocommerce' ), | |
); | |
} |
add_filter( 'woocommerce_breadcrumb_defaults', 'jk_woocommerce_breadcrumbs', 20 );
Change the home link to a different URL
↑ Back to top
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Replace the home link URL | |
*/ | |
add_filter( 'woocommerce_breadcrumb_home_url', 'woo_custom_breadrumb_home_url' ); | |
function woo_custom_breadrumb_home_url() { | |
return 'http://woocommerce.com'; | |
} |
add_filter( 'woocommerce_breadcrumb_defaults', 'woo_custom_breadrumb_home_url', 20 );
Remove the breadcrumbs
↑ Back to top.woocommerce-breadcrumb {
visibility:hidden;
}