Forums

Other single template (2 posts)

  1. stevenoi
    Member
    Posted 2 years ago #

    Hi, I got a little code which display's another single template than the default single.php if you're viewing category 1.

    <?php if ( in_category('1')) {include(TEMPLATEPATH.'/single-portfolio.php');
    } else { ?>

    But when I'm viewing a subcategory of category 1, it will display the default single.php instead of single-portfolio.php.

    Hope you can help me, Steven.

    [moderated--bump removed. Please refrain from bumping as per Forum Rules]

  2. MichaelH
    Volunteer
    Posted 2 years ago #

    Could do this:

    <?php if ( in_category(array(1,2,5))) {include(TEMPLATEPATH.'/single-portfolio.php');

    Also see the discussions at Template_Tags/in_category including "Testing if a post is in a descendant category".

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.