0

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='); ?>
</ul>

page.php

<?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">
            <ul>
            <li class="root"><?php echo '<a href="'.get_permalink($post->post_parent).'">'.get_the_title($post->post_parent).'</a>';?></li>
            <?php echo $children; ?>
            </ul>
            </div>
            <?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.

1 Answer 1

2

http://codex.wordpress.org/Function_Reference/wp_list_pages#Markup_and_styling_of_page_items

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

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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