I want to display the title from a parent field within a single child post (these are custom posts created with wp-types).
At the moment, all I seem to get is the title of the current post, and not the parent.
Below is my markup.
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<h2><?php the_title(); ?></h2>
<div class="the-copy">
<?php the_content(); ?>
</div>
<div class="parent-title">
<?php
$parent_title = get_the_title($post->post_parent);
echo $parent_title;
?>
</div>
<?php endwhile; ?>
<?php endif; ?>
Am I doing something wrong or have I missed something?
Thanks for you help, from what I can see this should be simple but it's just not working for me.