Skip to content

Instantly share code, notes, and snippets.

@eri-trabiccolo
Last active May 17, 2016 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eri-trabiccolo/bea4c56e7ef7b1622bfa47065b10fd87 to your computer and use it in GitHub Desktop.
Save eri-trabiccolo/bea4c56e7ef7b1622bfa47065b10fd87 to your computer and use it in GitHub Desktop.
Use woocommerce breadcrumbs
add_action( 'wp', 'tc_woocommerce_breadcrumb', 100 );
function tc_woocommerce_breadcrumb() {
//do nothing if we're not in the wc context
if ( ! ( function_exists( 'is_woocommerce' ) && is_woocommerce() ) )
return;
//turn off the theme's breadcrumb
add_filter( 'tc_opt_tc_breadcrumb', '__return_false' );
//display woocommerce breadcrumb before the main container
add_action( '__before_main_container', 'woocommerce_breadcrumb' );
//make the woocommerce breadcrumb look like the theme's one
//https://docs.woothemes.com/document/customise-the-woocommerce-breadcrumb/
add_filter( 'woocommerce_breadcrumb_defaults', 'jk_change_breadcrumb_delimiter' );
function jk_change_breadcrumb_delimiter( $defaults ) {
$defaults['delimiter'] = ' <span class="sep">&raquo</sep> ';
$defaults['wrap_before'] = '<div class="tc-hot-crumble container" role="navigation"><div class="row"><div class="span12"><div class="breadcrumb-trail breadcrumbs" itemprop="breadcrumb">';
$defaults['wrap_after'] = '</div></div></div></div>';
$defaults['home'] = __( 'Home', 'customizr' );
return $defaults;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment