Support » Fixing WordPress » Redirecting from single.php page

  • Hello,

    I would like for various single pages to be redirected from the original single.php page. In other words I would like entries from Category 1 to be placed into single1.php, Category 2 entries to be placed into single2.php and so on.

    I found the following, when placed in my single.php somewhat works:

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

    The only problem is that on the entries in single2, single3, single4, the post seems to repeat. The page will look as I want it but following the footer, the page will repeat itself in the single1.php format additionally.

    Anything that falls under the ‘else’ statement works fine and everything that is under the ‘if’ statement works, but is followed by a duplicate entry in this single1.php format.

    Can anyone help me with the syntax here. It doesn’t seem like it should be that complicated but I’m having some trouble getting it to work. Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Redirecting from single.php page’ is closed to new replies.