Using in_category for all children categories
-
Hello all
I have a large site with nuerous categories and multiple templates. In my single.php file I have a lot of IFs and ELSEIFs which check for categories.
<?php if ( in_category('X') ) { include(TEMPLATEPATH . '/this_template.php'); } else { include(TEMPLATEPATH . '/a_different_template.php'); } ?>
This has worked fine to a degree. However I want to be able to make all posts that are in the child category of X call a specific template file. So using the above example, if a post was in category Y that was a child of category X I would still want it to include the this_template.php file.
I hope this is achievable – any help much appreciated.
Cheers
Matt
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘Using in_category for all children categories’ is closed to new replies.