Using is_category() if category is not category x
-
Hi, I have a few custom menu bar items. One for ‘News’, which shows a category-16.php template for posts categorised as ‘News’, and a regular category.php file for all other category post pages.
When the menu bar button ‘News’ is clicked, I use a ‘is_category(‘News’) function to set the css class=”selected”.
However the second nav button needs a formula to add class=”selected” for is_category() to be true, but not if is_category(‘News’) is also true.
How can I do this? Is this a simple if… else function?
I have tried this but it brings about an error 500 error message. Is my formatting the issue?
<?php if (is_category('News')) : else : if (is_page('Cakes') || is_category('')) { echo 'id="selected"' } endif; ?>
- The topic ‘Using is_category() if category is not category x’ is closed to new replies.