Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #162959

    Hi,

    is it possible to avoid link tag in breadcrumb, if the page is private ? Indeed, it links to 404 page if you’re not connected, so just showing the page title in breadcrumb would be better.

    Thanks,
    Oli

    #163523

    Hi minestelecom!

    Try following – open up wp-content\themes\enfold\framework\php\class-breadcrumb.php and replace

    
    $parents[]  = '<a href="' . get_permalink( $post_id ) . '" title="' . esc_attr( get_the_title( $post_id ) ) . '">' . get_the_title( $post_id ) . '</a>';
    

    with

    
    if(get_post_status($post_id) == 'private'){
    $parents[]  = get_the_title( $post_id );
    }else{
    $parents[]  = '<a href="' . get_permalink( $post_id ) . '" title="' . esc_attr( get_the_title( $post_id ) ) . '">' . get_the_title( $post_id ) . '</a>';
    }
    
    

    Cheers!
    Peter

    #163540

    Hi,

    it doesn’t work, the breadcrumb displays in reverse…

    But it’s ok, when replacing with :

    if(get_post_status($post_id) == ‘private’)
    $parents[] = ‘‘ . get_the_title( $post_id ) . ‘‘;
    else
    $parents[] = ‘‘ . get_the_title( $post_id ) . ‘‘;

    Thanks for your help !

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘No link in breadcrumb if the page is private’ is closed to new replies.