Posts 2 Posts Relationships

Posts 2 Posts Relationships

Wordpress plugin

Install on Wordpress

App Details

This plugin allows you to create many-to-many relationships between posts of any type: post, page, custom post types, etc.

Configure post 2 post connections easily in a friendly interface.

The new connection metaboxes will appear on the related post edition pages. Search text, post type and term combo filter available as option for it.

Use the standard WP_Query() and get_posts() to get the related posts.

Solid-rock relationships: use his own database table, updated on post status change and removed on post deletion.

Getting related: the WP_Query way

// inside main loop, current post ID (p2p_rel_post_id) not needed, current post will be used if you don't set it: $args = array( 'p2p_rel_key' => 'prod_to_bars', // This is your connection key name. Required. 'p2p_rel_post_id' => 1, // The post ID. Inside main loop dont needed. 'p2p_rel_direction' => 'any', // The connection direction. 'any' by default. Optional. Explained below. ( can be 'any' | 'from_to' | 'to_from' ) // Of course, here you can add the standard WP arguments you need: post type, status, dates, pagination, etc. ); // (at this point, as any other WP looping): // The Query $the_query = new WP_Query( $args ); // The Loop if ( $the_query->have_posts() ) { echo '<ul>'; while ( $the_query->have_posts() ) { $the_query->the_post(); echo '<li>' . get_the_title() . '</li>'; } echo '</ul>'; } else { // no posts found echo '<p>Nothing related</p>'; } // Restore original Post Data wp_reset_postdata(); 

Getting related: the get_posts() way

// inside main loop, current post ID (p2p_rel_post_id) not needed, current post will be used if you don't set it: $args = array( 'p2p_rel_key' => 'prod_to_bars', // This is your connection key name. Required. 'p2p_rel_post_id' => 1, // The post ID. Inside main loop dont needed 'p2p_rel_direction' => 'any', // The connection direction. 'any' by default. Optional. Explained below. ( can be 'any' | 'from_to' | 'to_from' ) 'post_type' => 'any', // The filtered post types, can be an array. Optional. 'post' by default. (can be 'any' for all) 'suppress_filters' => false // Required // Of course, here you can add the standard WP arguments you need: post type, status, dates, pagination, etc. ); // (at this point, as any other WP looping): $rel_posts = get_posts ( $args ); print_r( $rel_posts ); 

Getting related: getting it raw

// inside main loop, current post ID (element_id) not needed, current post will be used if you don't set it: $args = array( 'key' => 'prod_to_bars', // This is your connection key name. Required. 'element_id' => 1, // The post ID. Inside main loop dont needed. 'element_type' => 'any', // The filtered post types, can be an array. Optional. 'post' by default. (can be 'any' for all) 'status' => 'any' // The filtered post status, can be an array. Optional. 'publish' by default. (can be 'any' for all) 'direction' => 'any', // The connection direction. 'any' by default. Optional. Explained below. ( can be 'any' | 'from_to' | 'to_from' ) ); global $P2P_Relationships; $rel_posts = $P2P_Relationships->get_raw ( $args ); // Only an array of related post IDs, not the posts objects. print_r ( $rel_posts ); 

The connection direction

By default, the connections are bidirectional (any). However, you can get related posts only in one direction: ‘from_to’ or ‘to_from’.

You can do the same logic at interface level for your users in the backoffice: you can setup your connection hidding the from metabox or the to metabox (UI mode setting).

Pricing

Starting from $0 per month.

Check Out the Website Translator Widget

By Common Ninja

Website TranslatorTry For Free!

App Info

Rating

Reviewers

1 reviews

Tags

custom post types
many-to-many
posts 2 posts
posts to posts

Developed By

wpcentrics

Quick & Easy

Find the Best Wordpress plugins for you

Common Ninja has a large selection of powerful Wordpress plugins that are easy to use, fully customizable, mobile-friendly and rich with features — so be sure to check them out!

Testimonial

Testimonial plugins for Wordpress

Galleries

Galleries plugins for Wordpress

SEO

SEO plugins for Wordpress

Contact Form

Contact Form plugins for Wordpress

Forms

Forms plugins for Wordpress

Social Feeds

Social Feeds plugins for Wordpress

Social Sharing

Social Sharing plugins for Wordpress

Events Calendar

Events Calendar plugins for Wordpress

Sliders

Sliders plugins for Wordpress

Analytics

Analytics plugins for Wordpress

Reviews

Reviews plugins for Wordpress

Comments

Comments plugins for Wordpress

Portfolio

Portfolio plugins for Wordpress

Maps

Maps plugins for Wordpress

Security

Security plugins for Wordpress

Translation

Translation plugins for Wordpress

Ads

Ads plugins for Wordpress

Video Player

Video Player plugins for Wordpress

Music Player

Music Player plugins for Wordpress

Backup

Backup plugins for Wordpress

Privacy

Privacy plugins for Wordpress

Optimize

Optimize plugins for Wordpress

Chat

Chat plugins for Wordpress

Countdown

Countdown plugins for Wordpress

Email Marketing

Email Marketing plugins for Wordpress

Tabs

Tabs plugins for Wordpress

Membership

Membership plugins for Wordpress

popup

popup plugins for Wordpress

SiteMap

SiteMap plugins for Wordpress

Payment

Payment plugins for Wordpress

Coming Soon

Coming Soon plugins for Wordpress

Ecommerce

Ecommerce plugins for Wordpress

Customer Support

Customer Support plugins for Wordpress

Inventory

Inventory plugins for Wordpress

Video Player

Video Player plugins for Wordpress

Testimonials

Testimonials plugins for Wordpress

Tabs

Tabs plugins for Wordpress

Social Sharing

Social Sharing plugins for Wordpress

Social Feeds

Social Feeds plugins for Wordpress

Slider

Slider plugins for Wordpress

Reviews

Reviews plugins for Wordpress

Portfolio

Portfolio plugins for Wordpress

Membership

Membership plugins for Wordpress

Forms

Forms plugins for Wordpress

Events Calendar

Events Calendar plugins for Wordpress

Contact

Contact plugins for Wordpress

Comments

Comments plugins for Wordpress

Analytics

Analytics plugins for Wordpress

Common Ninja Apps

Some of the best Common Ninja plugins for Wordpress

Browse our extensive collection of compatible plugins, and easily embed them on any website, blog, online store, e-commerce platform, or site builder.

Website Translator for Wordpress logo

Website Translator

Add a translation widget to your site so users can switch languages easily and access content in their preferred language.

Opening Hours for Wordpress logo

Opening Hours

Add opening hours to your site to give visitors clear, reliable business information that improves trust, reduces confusion, and supports user experience.

Testimonials Slider for Wordpress logo

Testimonials Slider

Add a testimonials slider to your site to showcase real customer feedback, build credibility, and increase trust that leads to higher conversions.

Animated Number Counter for Wordpress logo

Animated Number Counter

Show key stats with an animated number counter that draws attention, adds social proof, and helps increase trust and conversions.

Device Mockup for Wordpress logo

Device Mockup

Show products, apps, or designs inside a clean device mockup that improves visualization, builds credibility, and helps visitors make confident decisions.

Cookie Banner for Wordpress logo

Cookie Banner

Use a Cookie Banner to inform visitors about cookies on your site and let them manage their consent in a clear, structured way.

Code Snippets for Wordpress logo

Code Snippets

Display clean code snippets with syntax highlighting to improve technical content and help developers scan examples quickly.

LinkedIn Feed Carousel for Wordpress logo

LinkedIn Feed Carousel

Show LinkedIn posts with a LinkedIn feed carousel that auto updates, presents content in a smooth layout, and keeps visitors engaged.

Corner Button for Wordpress logo

Corner Button

Corner button that stays fixed on the screen to highlight promotions, improve navigation, and guide visitors toward important actions with clear visibility.

Quiz Maker for Wordpress logo

Quiz Maker

Create interactive quizzes with a quiz maker that lets you build custom questions, collect responses, and increase engagement with easy site integration.

Agenda for Wordpress logo

Agenda

Add an event agenda to your site to display schedules clearly, helping users understand timing and plan their attendance.

Countdown Bar for Wordpress logo

Countdown Bar

Add a countdown bar to your site to create urgency, highlight limited time offers, and drive faster engagement and higher conversions.

Discover Apps By Platform

Discover the best apps for your website

WordPress
Wix
Shopify
Weebly
Webflow
Joomla
PrestaShop
Shift4Shop
WebsiteX5
MODX
Opencart
NopCommerce

Common Ninja Search Engine

The Common Ninja Search Engine platform helps website builders find the best site widgets, apps, plugins, tools, add-ons, and extensions! Compatible with all major website building platforms - big or small - and updated regularly, our Search Engine tool provides you with the business tools your site needs!

Multiple platforms