I have the following function that lists all Child-Pages of a page.
function show_subpages() {
global $post;
$subpages = wp_list_pages( array(
'echo' =>0,
'title_li' =>'',
'depth' =>2,
'link_before' => '— ',
'child_of' => ( $post->post_parent == 0 ? $post->ID : $post->post_parent)
));
if ( !empty($subpages) ) {
echo '<ul id="subpages" class="wrapper">';
echo $subpages;
echo '</ul>';
}
}
So when I'm on the parent-page
I see a list with all the child-pages.
If I'm on a child-page
I see the same list with all the child-pages corresponding with the parent-page.
— My Parent Page
— My Child Page Nr. 1
— My Child Page Nr. 2
— My Child Page Nr. 3
This is almost what I want! The only little thing I need to add is to remove the "current" page I'm on from the list of child-pages.
So imagine I'm on My Child Page Nr. 2
I only want to list My Child Page Nr. 1
and My Child Page Nr. 3
but not "Nr. 2" since I'm currently on this one.
Any ideas how to add this?
Thank you in advance.