Support » Plugins and Hacks » Hacks » display one post inside another? single.php loop

  • Resolved TinyMonster

    (@tinymonster)


    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

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘display one post inside another? single.php loop’ is closed to new replies.