Title: [Plugin: Posts 2 Posts] Nested loop
Last modified: August 20, 2016

---

# [Plugin: Posts 2 Posts] Nested loop

 *  Resolved [johnbeeler](https://wordpress.org/support/users/johnbeeler/)
 * (@johnbeeler)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-nested-loop/)
 * Great plugin. I am having trouble though.
 * I have a page named shop. I am setting it up as an archive to display multiple
   albums for sale.
 * Here’s the relationship I have set-up:
 *  p2p_register_connection_type( array(
    ‘name’ => ‘artist_to_albums’, ‘from’ =
   > ‘ak-artist’, ‘to’ => ‘ak-merch’ ) );
 * There’s only one artist for each merch.
 * I have a wp_query pulling the pages ak-merch. I’d like to display the artist 
   name (the_title) within the subloop. I have tried multiple ways, but nothing 
   works. I’ve tried get_post, which gives me all the artist names (not the one 
   connected to the merch). I’ve tried a p2p type, but that just gets me the first
   artist name because then I have to reset the postdata and it gives me “store”(
   the page) as the title for everything forward.
 * Any ideas anyone?
 * [http://wordpress.org/extend/plugins/posts-to-posts/](http://wordpress.org/extend/plugins/posts-to-posts/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [scribu](https://wordpress.org/support/users/scribu/)
 * (@scribu)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-nested-loop/#post-2910953)
 * [https://github.com/scribu/wp-posts-to-posts/wiki/Looping-The-Loop](https://github.com/scribu/wp-posts-to-posts/wiki/Looping-The-Loop)

Viewing 1 replies (of 1 total)

The topic ‘[Plugin: Posts 2 Posts] Nested loop’ 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/)

 * 1 reply
 * 2 participants
 * Last reply from: [scribu](https://wordpress.org/support/users/scribu/)
 * Last activity: [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-nested-loop/#post-2910953)
 * Status: resolved