• Hello,

    I am currently using the following code to allow posts to follow a specific SINGLE template when posted in a specific category:

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

    For example, here, if a post is in category 13, it will be formatted under the single2.php template. If the post is in any other category, it will be posted under the single1.php template which is formatted differently.

    This is working like a treat however I am having difficultly with implementing this into my index.php

    When posts are displayed on the index, they are subject to a Div appearing with some code in. However, the posts in category-13 which go to Single2.php, do not have this DIV. But, the index.php will still show this div as it is already written into the index.php.

    Sorry if I have made this confusing, but what I need is a piece of code (modification/duplication of loop) that displays specifically formatted posts on the index according to what category they come from.

    Can anyone help?

  • The topic ‘Displaying posts defined by a Multiple-Single.php on Index.php’ is closed to new replies.