Last active
March 30, 2016 08:23
-
-
Save ville6000/3aecd1718554901bf301 to your computer and use it in GitHub Desktop.
Override Yoast SEO breadcrumb trail
This file contains hidden or 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
<?php | |
add_filter( 'wpseo_breadcrumb_links', 'override_yoast_breadcrumb_trail' ); | |
function override_yoast_breadcrumb_trail( $links ) { | |
if ( get_post_type() === 'employee' ) { | |
$breadcrumb[] = array( | |
'url' => get_permalink( get_page_by_title( 'contact' )->ID ), | |
'text' => __( 'Contact', 'your-text-domain' ), | |
); | |
array_splice( $links, 1, 1, $breadcrumb ); | |
} | |
return $links; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment