I’ve been wondering this myself. I just found this article and it works like a charm!
http://expatrick.com/2007/04/14/wordpress-name-of-parent-page/
<?php if (is_page()) {
if (!empty($post->post_parent)) {
$extradata = $wpdb->get_row("select post_title from wp_posts where ID = " . $post->post_parent);
echo $extradata->post_title;
} else {
echo $post->post_title;
}
} else {
echo "your text here";
}
?>
Hi!
I’ve found that :
<?php
$parent_title = get_the_title($post->post_parent);
echo $parent_title;
?>
Good luck!
I was not able to print the name of a parentpage using:
$parent_title = get_the_title($post->post_parent);
IS this doable using a small line of code ?
$parent_title = get_the_title($post->post_parent);
should work.
I used code suggested by hvaninah in a 2.7 version and it worked like magic! Thanks
or how about just <?php echo get_the_title($post->post_parent);?>
Awesome! Thanks bcnewmedia! That did exactly what I needed. :j