-1

I have a custom post type (team) and I do not use archive page (has_archive => false), when I visit single team post the breadcrumb contains inactive text "TeamSingleTitle". I would like to know how I can modify the breadcrumb function to remove this "Team" custom post name from the breadcrumb. I can't hide it using CSS as it's appended directly in front of the SingleTitle without even a space. If I change has_archive to true then it all works correctly and Team is created as a link and spaced accordingly.

  • Please edit your question to show the relevant code, so that we can try to help with debugging etc. – Pat J Jun 5 '14 at 1:19
  • It's not a code issue it's an issue due to the archive being set to false, the breadcrumb is still picking up the custom post type name and adding it to the breadcrumb. I'd just like to know the function to stop the breadcrumb from grabbing the custom post type name – Elle Billias Jun 5 '14 at 1:20
  • What are you using to generate your breadcrumbs? Is it a plugin or is it custom code written by you or someone else? If the former, then try the plugin's support forum; if the latter, then please, show us the code. Edited to add It might also be helpful to see the code that sets up the team custom post type. – Pat J Jun 5 '14 at 1:22
  • I'm not using any plugin - it's just the breadcrumb generated by Genesis theme/Wordpress – Elle Billias Jun 5 '14 at 1:25
  • 1
    That's OK i just worked it out so have posted my answer below in case any one else is looking :) – Elle Billias Jun 5 '14 at 1:43
0

Just grabbed a snippet from the get_cpt_crumb() function in the genesis breadcrumbs class file (/lib/classes/breadcrumb.php)

protected function get_cpt_crumb() {
    $post_type = get_query_var( 'post_type' );
    $post_type_object = get_post_type_object( $post_type );

    if ( $cpt_archive_link = get_post_type_archive_link( $post_type ) )
        $crumb = $this->get_breadcrumb_link( $cpt_archive_link, sprintf( __( 'View all %s', 'genesis' ), $post_type_object->labels->name ), $post_type_object->labels->name );
    else
        $crumb = $post_type_object->labels->name;

    $crumb .= $this->args['sep'] . single_post_title( '', false );

    return $crumb;
}

I just set my crumb to grab only the title and not the archives.

function eco_crumb_filter( $crumb, $args ) {
if ( is_singular( 'team' )  )
    return single_post_title( '', false );
else
    return $crumb;
}
add_filter( 'genesis_single_crumb', 'eco_crumb_filter', 10, 2 );
  • is it an answer, is it part of the question? what is this code? – Mark Kaplun Jul 1 '16 at 4:03
  • I found the solution to my own question – Elle Billias Jul 1 '16 at 8:22
  • then please accept it, the system thinks it still needs an answer and bumps it :( – Mark Kaplun Jul 1 '16 at 9:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.