WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] display one post inside another? single.php loop (3 posts)

  1. TinyMonster
    Member
    Posted 3 years ago #

    Hi this is my third attempt to post this, as my other 2 posts seem to have been deleted. Maybe they were in the wrong category?

    I am trying to use the loop to show the content and extra field values of one post inside another post using an extra field to specify the ID of the post I want to include.
    I can figure out the extra field bit's but can't get the loop to show the content of the other post.

    So inside my single.php I am adding the following if statement below where the_content etc:

    <?
    $otherPostID = get_post_meta($post->ID, otherPostID, true);
    if ($otherPostID) { ?>

    show loop here and get the ID of the post to include from $otherPostID

    <? } ?>

    The if statement works fine if I add an id number to my extra field, I just can't seem to manipulate the loop to get a specific posts content.
    I have looked through the forum and can only seem to find solutions to list posts on archive pages

    Any help would be much appreciated.

    Mr M

  2. esmi
    Forum Moderator
    Posted 3 years ago #

  3. TinyMonster
    Member
    Posted 3 years ago #

    Thanks :)

    I did work through that and couldn't figure it out. I have now though, after a 2nd look. :)

Topic Closed

This topic has been closed to new replies.

About this Topic