I have created a php function to expand upon the basic wp_list_pages function. But to do it I needed to find out a pages depth, I figured out how to do it on a single page, but when I send it do the custom list pages function it just returns zero for the pages being sent to it.
I use this within the wordpress page:
listpages($post);
And these functions
function pagedepth($page)
{
$ancestors = get_post_ancestors($page->ID);
return count($ancestors);
}
function listpoint($pg)
{
echo '<li><a href="';
echo get_page_link($pg->ID);
echo '">';
echo $pg->post_title;
echo '</a><small> ';
echo get_userdata($pg->post_author)->display_name;
echo '—';
if (get_post_custom_values('Character', $pg->ID)==TRUE)
{
$mykey_values = get_post_custom_values('Character', $pg->ID);
foreach ( $mykey_values as $key => $value )
{
echo $value;
echo ', ';
}
}
echo mysql2date('D, M j, Y H:i a', $pg->post_date);
echo '</small></li>';
}
function listpages($thepost)
{
echo '<ul>';
$pages = get_pages('child_of='.$thepost->ID.'&sort_column=post_date&sort_order=DESC');
$previousdepth = 0;
$homedepth = pagedepth($thepost);
foreach($pages as $page)
{
$pagedepth = pagedepth($page);
if($pagedepth > $previousdepth)
echo '<ul>';
while($pagedepth < $previousdepth && count(get_pages('child_of='.$page->ID)) != 0)
{ echo '</ul>';
$pagedepth--;
if($pagedepth == 1)
break;
}
$parent_page = $page->post_parent;
$content = $page->post_content;
if(!$content)
continue;
$content = apply_filters('the_content', $content);
listpoint($page);
$previousdepth = $pagedepth;
}
}
First solution gets paid $30 immediately. If done well and good I there will be more work down the track.