WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hi there Wordpress guru's,

i running up against a problem. I've my parent pages in the header.php and childpages in page.php. when i clicked on one of the subpages in a parent page i want that my parent page stay active. How can i get that done?

in my header.php i've the following code:

<ul id="mainNav">
 <?php wp_list_pages('sort_column=menu_order&exclude=2&depth=1&title_li='); ?>


<?php if($post->post_parent)
            $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0"); else
            $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
            if ($children) { ?>
            <div id="subPages">
            <li class="root"><?php echo '<a href="'.get_permalink($post->post_parent).'">'.get_the_title($post->post_parent).'</a>';?></li>
            <?php echo $children; ?>
            <?php } else { ?>
        <?php } ?>

U can see the example : here when you click on one of the subpages i want that the parent page (the tab above) stays active.

tnx for advance.

share|improve this question
up vote 2 down vote accepted


style .current_page_parent and/or .current_page_ancestor the same as .current_page_item

share|improve this answer
thank you very much dude:) it works great:). – Navid Aug 14 '11 at 4:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.