I want to display parent page only on sub-pages. I am using this code but it display parent page on every page.
<?php
$parent_title = get_the_title($post->post_parent);
echo $parent_title;
?>
you can try this
<?php
if($post->post_parent>0)
{
$parent_title = get_the_title($post->post_parent);
echo $parent_title;
}
?>