Found this way:
if ( 0 == $post->post_parent ) {
the_title();
} else {
$parents = get_post_ancestors( $post->ID );
echo apply_filters( "the_title", get_the_title( end ( $parents ) ) );
}
Anyone got a better way please answer.
Found this way:
if ( 0 == $post->post_parent ) {
the_title();
} else {
$parents = get_post_ancestors( $post->ID );
echo apply_filters( "the_title", get_the_title( end ( $parents ) ) );
}
Anyone got a better way please answer.