• Hello,

    I am using a simple breadcrumb code that I cannot get to link properly to 2 single.php templates that use 2 custom post types. It will echo the link to either Portfolio or Artwork, but not both at the same time. Here’s the portion of the code I need help with. The entire breadcrumb code can be found at http://pastebin.com/RbMH3vS2

    global $post;
    $type = get_post_type($post->ID);
    
    if( $type != 'portfolio') {
    echo '<a href="' . 'http://www.mysite.com/web-portfolio'  . '">' . Portfolio.    '</a>' .$markup;
     }
    
     } else if( $type != 'artwork') {{
     echo '<a href="' . 'http://www.mysite.com/art-portfolio'  . '">' . Artwork .  '</a>' .$markup;
     }
    
     }else{
     echo $output;
    
      }
    }

    What am I doing wrong, it currently links to “Artwork” on both pages?

Viewing 1 replies (of 1 total)
  • Thread Starter zoacode

    (@zoacode)

    This was resolved with:

    if(get_post_type() == 'Portfolio'){
     echo '<a href="' . 'http://www.mysite.com/web-portfolio'  . '">' .  'Portfolio'. '</a>' . $markup;
    
    } else if(get_post_type() == 'Artwork'){
     echo '<a href="' . 'http://www.mysite.com/art-portfolio'  . '">' . 'Artwork' .  '</a>' . $markup;
    }
Viewing 1 replies (of 1 total)

The topic ‘2 custom post types linking to 2 single.php templates ?’ is closed to new replies.