Relations Post Types
This plugin allow to build relation between 2 custom types (posts, page, custom), very useful for manage related content on CMS type website. A few example use cases: manually lists of related posts post series rented houses connected to agency etc. Relationships are created from a settings page fro
This plugin allow to build relation between 2 custom types (posts, page, custom), very useful for manage related content on CMS type website.
A few example use cases:
- manually lists of related posts
- post series
- rented houses connected to agency
- etc.
Relationships are created from a settings page from the administration console.
This plugin can not do relationships with users, you should test this excellent plugin made by scribu https://wordpress.org/extend/plugins/posts-to-posts/
Screenshots & previews.
- 01Download, unzip and upload to your WordPress plugins directory
- 02Activate the plugin within you WordPress Administration Backend
- 03Go to Settings > Relations and enable relation between post type.
Display relations in its theme
Example, display 5 related pages in your single.php template :
<?php $related_pages_ids = rpt_get_object_relation($id_post, 'page'); if ( count($related_pages_ids) >= 1 ) { $related_pages = query_posts( array( 'post_type' => 'page', 'post_status' => 'publish', 'posts_per_page' => 5 'post__in' => $related_pages_ids, 'orderby' => 'post_date', 'order' => 'DESC', ) ); echo 'Related pages' . "\n"; echo '<ul>' . "\n"; foreach ( $related_pages as $post ) { echo '<li><a href="'.get_permalink($post).'">'.get_the_title($post).'</a></li>' . "\n"; } echo '</ul>' . "\n"; } ?>