Support » Themes and Templates » Sub-menu issue

  • Resolved Webb7


    I got my menu (left side) to display the relevant submenu when the parent was click on. But when you click onto that sub menu, the rest disappears.


    When clicked on the parent page it will list the sub pages below but when I click onto one of those sub pages, then they will no longer be there.

    Here is the coding which I’m using:

    	// will display the subpages of this top level page
    	$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
    	// diplays only the subpages of parent level
    	//$children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
    		// now you can get the the top ID of this page
    		// wp is putting the ids DESC, thats why the top level ID is the last one
    		$ancestors = end($post->ancestors);
    		$children = wp_list_pages("title_li=&child_of=".$ancestors."&echo=0");
    		// you will always get the whole subpages list
    if ($children) { ?>
    		<?php echo $children; ?>
    <?php } ?>

    For my CSS:

    .page_item .children {
      display: none;
    .current_page_item .children {
      display: block;

    Anyone know how I can get it successfully work so that when I’m on the sub page it will display the sub pages under that parent.

Viewing 1 replies (of 1 total)
  • Solved by adding this to my CSS instead

    ul.children {display: none;}
    .current_page_item ul.children,
    .current_page_parent ul.children {display: block;}

Viewing 1 replies (of 1 total)
  • The topic ‘Sub-menu issue’ is closed to new replies.