PHP Sidebar Navigation in Wordpress

I am new to PHP and Wordpress. I am attempting to create a new sidebar theme to display the third tier of the menu when on the second tier. Example:

PAGE1
-SUB1
-SUB2
–THIRD1
–THIRD2
-SUB3
PAGE2
PAGE3

Currently when I am on PAGE1; SUB1, 2 and 3 appear in the sidebar. however when I am on SUB2 only SUB1, 2 and 3 show up instead of THIRD1 and 2. I am pretty sure this is the PHP file that is giving me the issue. (below) Any help or suggestions would be appreciated. Thanks -Joey

[php]<?php

if(!$post->post_parent){

	$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0&depth=1&exclude=-107");

}else{

if($post->ancestors)

{

	$ancestors = end($post->ancestors);

	$children = wp_list_pages("title_li=&child_of=".$ancestors."&echo=0&depth=1&exclude=-107");

}

}

if ($children) { ?>

<ul class="subnav">

	<?php echo $children; ?>

</ul>
<?php } ?>[/php]

You will probably have more luck on a wordpress forum.

Sponsor our Newsletter | Privacy Policy | Terms of Service