Sub Sub Pages – Showing Main Parent Dynamically
-
I have a main nav menu that had 5 main parent pages listed in it, and it’s done with CSS and sprites, so there is a normal, over and active states that CSS switches between.
Per the Codex I found and have used this if_page tag to add the an active class to the button so it will show if a visitor is on the parent page or the first level of sub papes:
<?php if ( is_page('about') || $post->post_parent == '2' ) { echo " class=\"active\""; } ?>
But when I add a Sub-Sub Page, meaning a of the 5 main parent pages would be a grandparent page, and navigate to the Sub-Sub Page I lose the active class. Is there something I can add or change do if I’m on in page below just a Sub Page it will still dynamically create my active class?
Thanks
- The topic ‘Sub Sub Pages – Showing Main Parent Dynamically’ is closed to new replies.