Created
August 26, 2018 09:48
-
-
Save mrkdevelopment/3bc61c09749ddf804db4a748f5da49eb to your computer and use it in GitHub Desktop.
Breadcrumb Update for Yoast Breadcrumbs Path in Custom Post
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( 'wpseo_breadcrumb_links', 'wpse_100012_override_yoast_breadcrumb_trail' ); | |
function wpse_100012_override_yoast_breadcrumb_trail( $links ) { | |
global $post; | |
if (is_tax( 'df_product_category' )) { | |
$breadcrumb[] = array( | |
'url' => get_post_type_archive_link( 'df_wordpress_product' ), | |
'text' => 'Products', | |
); | |
array_splice( $links, 1, -2, $breadcrumb ); | |
} | |
return $links; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To read about this code snippet feel free to check out https://www.diviframework.com/topic/breadcrumb-module-custom-post-types-and-categories/