Created
April 22, 2020 10:33
-
-
Save nvourva/32420d4c1385ddc33d9f05183347fe1b to your computer and use it in GitHub Desktop.
Add blog link to WooCommerce breadcrumbs
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
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