Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter chrisatlemon

    (@chrisatlemon)

    Hmm, I’m not really sure why I never get an answer here, maybe my questions are too complicated? Maybe it wasn’t so smart to change from MT, I always got great support there…

    In any case, after about 4 hours of digging on this I found a solution, but not an explanation, I hope ot helps out someone in the same predicament:

    Create a single.php file which only contains this:

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

    So, if my single post is in category 5 it will use single2.php template and if it’s in any other category it will use single1.php.

    So I got it to work how I want, yet I still can’t explain why on my other server the single posts in category 5 use category-5.php and not single.php template while on the other I have to do the above to get the same results…

    Hope it helps someone out…

    Chris

    Actually in your initial post what is supposed to be a link to “single” post view is:
    a) totally not styled (text only) page or
    b) not a single post view but cat listing.

    So, I got confused.
    Furthermore: single post view never inherits the catgeory template.
    Actually there is a plugin that lets you use different templates for single based on category:
    http://guff.szub.net/2005/07/21/post-templates-by-category/
    (on the same site you’ll find a link to an “inheritor: plugin 🙂

    Thread Starter chrisatlemon

    (@chrisatlemon)

    Hi, thanks for the reply 🙂

    Sorry to confuse you:

    1) the non-styling is intentional, I just want to create pure content and include elsewhere
    2) http://www.natural-clothing.com/content/category/Static-about-pages/

    this IS category view, I just had it configured to show only the last post. Now you see the last 2, maybe that’s clearer 🙂

    Maybe by some strange coincidence, this single post:

    http://www.searchspanishproperty.com/content/31.php

    uses the non styled catepory template. While all single posts in other categories use the single.php template, like here:

    http://www.searchspanishproperty.com/content/buying-overseas-property-using-a-self-invested-personal-pension.php

    Cheers 🙂

    Chris

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Per category templates’ is closed to new replies.