Support » Fixing WordPress » if in category single.php trouble

  • Resolved sturvey

    (@sturvey)


    I’m trying to use single.php to direct to different templates depending on what category the post is in. This works fine when I have one if statement, but when I use two like follows it messes up:

    <?php
     $post = $wp_query->post;
     if ( in_category('11') ) {
     include(TEMPLATEPATH . '/single2.php');
    } 
    
     if ( in_category('15') ) {
     include(TEMPLATEPATH . '/single3');
    }
    
    else {
     include(TEMPLATEPATH . '/single1.php');
     }
     ?>

    Please help!

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘if in category single.php trouble’ is closed to new replies.