# is_page() and other conditional statements
-
Good afternoon,
I have been trying to work with the dynamic menu highlighting at https://codex.www.ads-software.com/Dynamic_Menu_Highlighting . I’ve run into a huge issue with the tutorial that renderes it quite useless unless there is a solution. There is no way to question if a post is under a category. I’ve got tabs for 3 categories and when viewing any post it seems impossible to query it using the “is” statements based upon the category it is in, therefore rendering the dyanamic highlighting menu non-functional once you get past the category archive.
This is what I’ve got so far:
<?php
if ( is_home() ) { $current = 'one'; }
elseif ( is_category('News') ) { $current = 'two'; }
elseif ( is_single('news') ) { $current = 'two'; }
elseif ( is_category('1') ) { $current = 'three'; }
elseif ( is_category('3') ) { $current = 'four'; }
elseif ( is_page('gallery') ) { $current = 'five'; }
elseif ( is_page('junctions') ) { $current = 'six'; }
elseif ( is_page('contact') ) { $current = 'seven'; }
?>I’ve read through all the “is”conditional tags at https://codex.www.ads-software.com/Conditional_Tags and there just does not seem to be one to identify a post by it’s category. Can any one help me? Thanks.
- The topic ‘# is_page() and other conditional statements’ is closed to new replies.