if is in ‘news’ category but is not index
-
OK, I’m not to great at this stuff and I’ve confused myself a little, I’m working on a navigation menu with an ‘active’ class, so far I have most parts working with code like this:
<li><a href="/index.php" title="home" <?php if(is_home()) {?>class="current"<?php } ?>><span></span>Home</a></li>
This works perfectly however I’m trying to create a new active button for any posts in the ‘news’ category using this code…
<li><a href="/news/" title="News" <?php if (is_page_template('news.php')) {?>class="current"<?php } ?><?php if (in_category('3')) {?>class="current"<?php } ?>><span></span>News</a></li>
but this also highlights the news tab when I’m on the index page, so what I’d like to do is create some code that tells wordpress…
if is in category 'news' then class="current" but if is in category 'news' and the current page is homepage class= nothing
anyone able to help me out?
Thanks.
- The topic ‘if is in ‘news’ category but is not index’ is closed to new replies.