• Resolved scottwvw

    (@scottwvw)


    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.

Viewing 1 replies (of 1 total)
  • Thread Starter scottwvw

    (@scottwvw)

    Managed to find the solution here

    Essentially, as I was using the Types plugin standard parent / child wordpress code wouldn’t work

Viewing 1 replies (of 1 total)

The topic ‘Displaying Parent field in child post’ is closed to new replies.