• Hi
    I have couple of posts related to multiple categories each.
    I would like to have a different template for each post based on the category the viewer is currently in
    currently I changed my single.php to –
    <?php
    $post = $wp_query->post;

    if (in_category(‘3,4’)) {
    include(TEMPLATEPATH.’/single-a.php’);
    } else {
    include(TEMPLATEPATH.’/single-b.php’);
    }
    ?>

    but I still get it wrong same template no matter what category Im currently viewing

    any idea

    thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • lisa

    (@contentiskey)

    what about using the archive.php or category.php file instead of single.php.
    i don’t know what theme you are using so i don’t know if those templates are available to you or if you might need create theme

    resource to help with visualizing template file order:
    https://wphierarchy.com/

    Thread Starter pikaya

    (@pikaya)

    Thanks
    Im using the ‘responsive’ theme
    and I meant single.php template not totaly different template…:)

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘same post different templates based on category’ is closed to new replies.