is_category() not working with multiple arguments
-
I have 2 categories, Sermons and Articles, under those categories I have SermonsYYYY and ArticlesYYYY categories. I’m editing my category.php file to check which category it is and show a custom header based on what it is…this is my code right now:
<?php /* Check category and show appropriate static information before posts */ if (is_category('sermons','sermons2011','sermons2010','sermons2009','sermons2008')) { echo 'Sermons'; } if (is_category('articles','articles2011','articles2010')) { echo 'Articles'; } ?>
Ideally I’d like to be able to just check to see the category is ‘Sermons’ or a child of ‘Sermons’, but I haven’t found the right syntax yet so I’m listing them all out. The problem now is this isn’t working either. I only get the echo’ed ‘Sermons’ or ‘Articles’ when I’m at the parent category, which is the first argument in each is_category() if statement.
Could someone help me come up with a better solution? I know the way it’s being done now isn’t the best because this way even if I could make it work I’d have to come update it every time I create a new child category.
- The topic ‘is_category() not working with multiple arguments’ is closed to new replies.