The code you are using only gets the children of a parent page. It first checks to see in which page you are. If you are in a child page it uses the parent ID to print it’s children. If you’re in a parent page then it just looks for it’s children using the post ID. Neither case it prints the actual parent. I edited the code so that it will print the parent. If you’re in a child page it will get the parent using get_the_title(), if you’re in a parent page then you already have that information in the $post object. See if that works for you.
function wpb_list_child_pages() {
global $post;
$parent = "";
if ( is_page() && $post->post_parent ) {
$childpages = wp_list_pages( 'sort_column=menu_order&title_li=&child_of=" . $post->post_parent . "&echo=0' );
$parent = get_the_title($post->post_parent);
} else {
$childpages = wp_list_pages( 'sort_column=menu_order&title_li=&child_of=" . $post->ID . "&echo=0' );
$parent = $post->post_title;
}
if ( $childpages ) {
$string = '<ul><li>' . $parent . ';
$string .= '<ul>' . $childpages . '</ul>';
$string .= '</li></ul>';
}
return $string;
}
add_shortcode( 'wpb_childpages', 'wpb_list_child_pages' );
Alternatively you can also make the parent title a link by using get_permalink().