Creating sub nav using wp_list_pages();

I’m using the following code to produce a list of pages that are the bottom 2 levels of my wordpress page hierarchy:

<?php
if($post->ancestors){
    $ancestors = end($post->ancestors);
    $children = wp_list_pages("title_li=&child_of=".$ancestors."");
}
?>

This seems to also bring in all the pages which are higher than the last 2 levels though.
Is there anything I can add to the the code above to make it list only the very bottom 2 level pages?

Related posts

Leave a Reply