Title: [Plugin: Posts 2 Posts] Combined loops
Last modified: August 20, 2016

---

# [Plugin: Posts 2 Posts] Combined loops

 *  Resolved [markus](https://wordpress.org/support/users/markusstaas/)
 * (@markusstaas)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-combined-loops/)
 * Hi Scribu,
 * first of all, thank you very much for putting all this time and effort into this
   plugin!! It really enhances WordPress usefulness!! Thanks.
 * However, I have a problem:
 * I am working with a custom post type and custom fields that are connected using
   your plugin, so within a single post that I get off a custom post type I need
   to display several connections within the custom post type loop. It does not 
   seem to work, the loops seem to overlap. I apologize if this is a nb question
   but I am not a full blown developer, rather a UX Designer and heavy CMS consultant
   🙂 I have posted my code below. If someone on here could give me some advice,
   that would be great!
 * Thank you,
 * Markus
 * _[55 lines of code moderated as per the [Forum Rules](http://codex.wordpress.org/Forum_Welcome#Posting_Code).
   The maximum number of lines of code that you can post in these forums is **ten
   lines**. Please use the [pastebin](http://wordpress.pastebin.com/)]_
 * [http://wordpress.org/extend/plugins/posts-to-posts/](http://wordpress.org/extend/plugins/posts-to-posts/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [scribu](https://wordpress.org/support/users/scribu/)
 * (@scribu)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-combined-loops/#post-2612927)
 * As the moderator said, please use [http://wordpress.pastebin.com/](http://wordpress.pastebin.com/)
   for sharing the code.
 *  Thread Starter [markus](https://wordpress.org/support/users/markusstaas/)
 * (@markusstaas)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-combined-loops/#post-2612987)
 * Sorry for being so difficult 🙂
 * here is the link to pastie:
 * [http://www.pastie.org/3543816](http://www.pastie.org/3543816)
 *  Plugin Author [scribu](https://wordpress.org/support/users/scribu/)
 * (@scribu)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-combined-loops/#post-2612990)
 * You might want to have a look at each_connected():
 * [https://github.com/scribu/wp-posts-to-posts/wiki/Looping-The-Loop](https://github.com/scribu/wp-posts-to-posts/wiki/Looping-The-Loop)
 * Also, make sure that get_queried_object_id() returns what you expect:
 * [http://wordpress.org/support/topic/plugin-posts-2-posts-cant-display-connected-posts-am-i-doing-this-correct](http://wordpress.org/support/topic/plugin-posts-2-posts-cant-display-connected-posts-am-i-doing-this-correct)
 *  Thread Starter [markus](https://wordpress.org/support/users/markusstaas/)
 * (@markusstaas)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-combined-loops/#post-2612996)
 * Thanks! I am using this code and it works well:
 *     ```
       <?php
       		// Find connected pages
       		$relVenue = p2p_type( 'ven2sess' )->get_connected( $post->ID );
   
       		// Display connected pages
       		echo '<p>Venue:</p>';
       		p2p_list_posts( $relVenue );
   
       		// Find connected pages
       		$relSpeak = p2p_type( 'speak2sess' )->get_connected( $post->ID );
   
       		// Display connected pages
       		echo '<p>Speakers:</p>';
       		p2p_list_posts( $relSpeak );
       	?>
       ```
   

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘[Plugin: Posts 2 Posts] Combined loops’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/posts-to-posts_7a8e9d.svg)
 * [Posts 2 Posts](https://wordpress.org/plugins/posts-to-posts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/posts-to-posts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/posts-to-posts/)
 * [Active Topics](https://wordpress.org/support/plugin/posts-to-posts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/posts-to-posts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/posts-to-posts/reviews/)

## Tags

 * [combined](https://wordpress.org/support/topic-tag/combined/)
 * [custom fields](https://wordpress.org/support/topic-tag/custom-fields/)
 * [loops](https://wordpress.org/support/topic-tag/loops/)

 * 4 replies
 * 2 participants
 * Last reply from: [markus](https://wordpress.org/support/users/markusstaas/)
 * Last activity: [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-combined-loops/#post-2612996)
 * Status: resolved