Title: p2p_connection_exists Inside Loop?
Last modified: August 22, 2016

---

# p2p_connection_exists Inside Loop?

 *  [Giganaut](https://wordpress.org/support/users/giganaut/)
 * (@giganaut)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/p2p_connection_exists-inside-loop/)
 * Hello,
 * I wish to add some conditional html on an archive page if a ‘product’ post type
   has a ‘special offer’ post type connected to it. Inside my products archive loop
   I have this:
 *     ```
       <?php if ( p2p_connection_exists( 'offers_to_products', array( 'from' => 'special-offers', 'to' => 'products' ) ) ) {
        	echo "Fish";
        } else {
        	echo "Fingers";
        }?>
       ```
   
 * But only ever get a negative result. Am I missing something?
 * [https://wordpress.org/plugins/posts-to-posts/](https://wordpress.org/plugins/posts-to-posts/)

The topic ‘p2p_connection_exists Inside 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/)

## Tags

 * [posts-2-posts](https://wordpress.org/support/topic-tag/posts-2-posts/)

 * 0 replies
 * 1 participant
 * Last reply from: [Giganaut](https://wordpress.org/support/users/giganaut/)
 * Last activity: [11 years, 2 months ago](https://wordpress.org/support/topic/p2p_connection_exists-inside-loop/)
 * Status: not resolved