Skip to content

Instantly share code, notes, and snippets.

@nvourva
Created April 22, 2020 10:33
Show Gist options
  • Save nvourva/32420d4c1385ddc33d9f05183347fe1b to your computer and use it in GitHub Desktop.
Save nvourva/32420d4c1385ddc33d9f05183347fe1b to your computer and use it in GitHub Desktop.
Add blog link to WooCommerce breadcrumbs
add_filter( 'woocommerce_get_breadcrumb', function( $crumbs, $breadcrumb ) {
if( is_singular( 'post' ) || is_category() ) {
$new_breadcrumb = [
_x( 'Blog', 'woo-breadcrumb', 'ci-theme' ),
get_post_type_archive_link( 'post' ),
];
array_splice( $crumbs, 1, 0, [ $new_breadcrumb ] );
}
return $crumbs;
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment