Menu depth problem
-
Hello everyone,
I’ve been struggling with a menu problem all day, and I can’t seem to find any solution on the internet.
I have 2 menus on my WordPress site that look like this: http://i51.tinypic.com/t8uipx.jpg.
I have three pages with the following hierarchy:
– Parent 1
– Child 1
– Baby 1The problem is that the top menu shows both Child and Baby pages, while I only want it to show Parent and Child pages. The sidebar menu shows Child and Baby pages, while I only want it to show Baby pages.
This is the code that I use for the top menu:
<div id="navigation"> <!-- Begin navigation --> <ul> <?php wp_list_pages('title_li=&depth=1'); ?> </ul> <?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 && is_page()) { ?> <ul id="child"> <?php echo $children; ?> </ul> <?php } else { ?> <?php } ?> <!--<ul> <li><a href="<?php echo get_option('home'); ?>/">Blog</a></li> <?php wp_list_pages('title_li=&depth=1'); ?> </ul>--> </div><!--End navigation -->This is the code that I use for the sidebar menu:
<div id="sidebar"> <?php if (is_page( )) { $page = get_query_var('page_id'); $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; ?> </div>Can anyone please help me with this issue? I would greatly appreciate it.
Thanks!
The topic ‘Menu depth problem’ is closed to new replies.