Hello,
I am trying to make seperate navigations. The basic outlay:
main menu
sub menu
sidebar: sub sub
I have the following code for this:
sub menu:
if($post->post_parent)
$children = wp_list_pages('title_li=&child_of='.$post->post_parent.'&echo=0&depth=1');
else
$children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0&depth=1');
if ($children) { ?>
<ul>
<?php echo $children; ?>
</ul>
<?php } ?>
sub sub in sidebar:
/* Fetch the pages, if there is a <ul> in the list it means that we haven't reached lvl 3 so don't do anything :) */
if($post->post_parent != 0)
{
$subsub = wp_list_pages('echo=0&title_li=&child_of='.$post->ID.'&depth=2');
<ul id="subsub">
<?
echo $subsub;
?>
</ul>
}
?>
The problem is, once I visit a sub sub page, the sub sub menu is listed in the sub menu, the sub menu is gone (main menu is listed manualy), and the sub sub menu is empty.
I though I could do a workaround by checking with post_parent how deep I am, but it doesn't seem to work like this:
`$a = $post->ID;
$b = $a->post_parent;
$c = $b->post_parent;ยด
any help here would be much appreciated ^^