Problem with Conditional Tag
-
I have standard conditional statements to create “active” states for the nav here:
https://www.foxhoundstudio.com/clients/marco/
As you can see, both “Home” AND “Members Area” are both “active” right now. For some reason, the home page thinks it is in_category(14) … and I can’t figure out why.
I currently have cat 14 as a parent category like this:
(14) Members Area
(15)- sub cat
(##)– sub sub cat
(20)- sub cat
(##)– sub sub catusing in_category(##) for any of the above categories, makes the home page thinks it is in that category (but it’s not even a category page … wtf ?) I tried using in_category(13) and it was fine.
I tried stripping EVERYTHING out, literally so that the page had no header, no footer, and the index.php simply said “if in_category(14)” and it was still showing up.
My code looks like this:
<li<?php global $post; if ( is_home() ) { echo ' class="active"'; } ?>><a href="<?php bloginfo('home'); ?>">Home</a></li> <li<?php global $post; if ( is_page('services') ) { echo ' class="active"'; } ?>><a href="<?php bloginfo('home'); ?>/services">Services</a></li> <li<?php global $post; if ( in_category(14) || is_page('members') ) { echo ' class="active"'; } ?> id="nav-members">
I tested functions.php by deleting it … that’s not the problem.
I tested all plugins by deactivating all of them … they are not the problem.
I tested “is_page(‘members’)” by removing it … it is not the problem (it is definitely “in_category(14)”Can anyone maybe shed some light on this?
- The topic ‘Problem with Conditional Tag’ is closed to new replies.