Skip to content

Instantly share code, notes, and snippets.

@tomharrigan
Created December 24, 2012 02:45
Show Gist options
  • Save tomharrigan/4367225 to your computer and use it in GitHub Desktop.
Save tomharrigan/4367225 to your computer and use it in GitHub Desktop.
change products to reports in breadcrumb
// Replace "Products" with "Reports" in breadcrumb.
add_filter( 'woo_breadcrumbs_trail', 'woo_custom_filter_breadcrumbs_trail_replaceproducts', 40 );
function woo_custom_filter_breadcrumbs_trail_replaceproducts ( $trail ) {
foreach ( $trail as $k => $v ) {
if ( is_singular() && ( get_post_type() == 'product' ) && strtolower( strip_tags( $v ) ) == 'products' ) {
unset( $trail[$k] );
}
if ( ! is_singular() && strtolower( strip_tags( $v ) ) == 'products' ) {
$trail[$k] = str_replace( 'Products', 'Reports', $v );
break;
}
}
return $trail;
} // End woo_custom_filter_breadcrumbs_trail_replaceproducts()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment