Support » Fixing WordPress » Keeping nests on menus

  • Driving myself round the bend with this one.

    On my left hand nav I am using the common code to list the child pages of a top nav page, then show the grandchild pages if a link is clicked that has grandchildren.

    					$output = wp_list_pages('echo=0&depth=1&title_li=<h2>Top Level Pages </h2>' );
    					if (is_page( )) {
    					  $page = $post->ID;
    					  if ($post->post_parent) {
    					    $page = $post->post_parent;
    					  $children=wp_list_pages( 'echo=0&child_of=' . $page . '&title_li=' );
    					  if ($children) {
    					    $output = wp_list_pages ('echo=0&child_of=' . $page . '&title_li=<h2>Child Pages</h2>');
    					echo $output;

    Now, when I click one of the grandchildren it shows a new menu of just the grandchildren. But i want it to stay just as it was on the child page.. I cannot for the life of me figure it out though!

    How it is appears on child page:

    Child 1
    Child 2
    > Grandchild 1
    > Grandchild 2
    Child 3

    How it appears on a grandchild page:

    Grandchild 1
    Grandchild 2

    Any help is massively appreciated!


  • The topic ‘Keeping nests on menus’ is closed to new replies.