Post template per category?

I have this single.php…

<?php
$post = $wp_query->post;
if (in_category(‘portfolio’)) {
include(STYLESHEETPATH.’/single_portfolio.php’);
} elseif (in_category(‘video’)) {
include(STYLESHEETPATH.’/single-video.php’);
}
else{
include(STYLESHEETPATH.’/single-text.php’);
}
?>

This all works, but the re is a problem.
Example, I have Video as a parent category, and under category, or child category is Music, and if I tick that post only belongs to Music, than it will be single-text.php what will be used, how do I make it use single-video.php even if its not ticked in Video, but its child categories?

Read more here:: Post template per category?

Leave a Reply

Your email address will not be published. Required fields are marked *