Skip to content

Instantly share code, notes, and snippets.

@CNick
Last active January 9, 2018 19:57
Show Gist options
  • Save CNick/ee086d72538f6ac5bb6f1b381bd8478a to your computer and use it in GitHub Desktop.
Save CNick/ee086d72538f6ac5bb6f1b381bd8478a to your computer and use it in GitHub Desktop.
/*
** Reposition WooCommerce breadcrumb
** Adjust array as needed to wrap breadcrumb & change delimiter
*/
add_action( 'init', 'jk_remove_wc_breadcrumbs' );
function jk_remove_wc_breadcrumbs() {
remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0 );
}
add_action( 'woo_custom_breadcrumb', 'woocommerce_custom_breadcrumb' );
function woocommerce_custom_breadcrumb(){
woocommerce_breadcrumb();
}
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 to theme file, or as part of another function to add
** breadcrumbs where they should appear
*/
<?php do_action('woo_custom_breadcrumb'); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment