Get immediate parent and child pages
<?php
if($post->post_parent)
$children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0&sort_column=menu_order");
else
$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0&sort_column=menu_order");
if ($children) {
$parent_title = get_the_title($post->post_parent);?>
<li><a href="<?php echo get_permalink($post->post_parent) ?>"><?php echo $parent_title;?></a></li>
<?php echo $children; ?>
<?php } ?>
Get top most parent id in worpdress
$parents = get_post_ancestors( $post->ID );
$get_top_parent_id = ($parents) ? $parents[count($parents)-1]: $post->ID;
Get all label parents or children pages
<?php
$parents = get_post_ancestors( $post->ID );
$get_top_parent_id = ($parents) ? $parents[count($parents)-1]: $post->ID;
$children = wp_list_pages("title_li=&child_of=".$get_top_parent_id."&echo=0&sort_column=menu_order");
if ($children) {
$top_most_post = get_post($get_top_parent_id);
$parent_selected = '';
if($post->ID==$get_top_parent_id){
$parent_selected = 'class="current_page_item"';
}
?>
<ul>
<li <?php echo $parent_selected; ?>><a href="<?php echo get_permalink($top_most_post) ?>"><?php echo get_the_title($top_most_post);?></a></li>
<?php echo $children; ?>
</ul>
<?php } ?>