WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] if in category single.php trouble (3 posts)

  1. sturvey
    Member
    Posted 7 years ago #

    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!

  2. Chris_K
    Member
    Posted 7 years ago #

  3. sturvey
    Member
    Posted 7 years ago #

    Thanks

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags