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 there 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?

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.