A new version of WordPress Creation Kit is now available: 2.0.4 with Post to Post Relationships
WordPress Post to Post Relationships
In WordPress post types are often in a relationship of some sort. For example, you might want to relate a soccer player to a team. You could do it with taxonomies, but it can become cumbersome and it won’t really do what you wanted it to do.
I wanted to use a post to post relationship in my project using other plugins, but I got really stuck when I tried to integrate those in my theme! I’m really not a programmer.
Truth is, post to post relationship plugins have been around for quite some time. The CPT Select field in WCK quite some time ago, but to really make use of it you had to open up your editor and start getting really good at WP_Query.
Post to Post Relationships with Swift Templates
This is how you go from wasting hours of frustration searching Google and Stackexchange by trying to build multiple queries in your templates, to constructing a simple HTML template with some tags in it. Sounds simple enough, so let’s get going.
1. Add a CPT Select to the post type that needs to be related
2. Link the Team CPT with the Player CPT
3. Get access to all of the Player information when creating a Team Swift Template
No coding required
This is something that used to require hiring a developer at 50$ or more per hour to do. Now you can just create post to post relationships and templates by clicking around in your WordPress backend.
Widget
Any Swift Template shortcode can be inserted in a Text Widget. So you can list your post to post relationships with all the extra information you might need directly in your sidebar.
Drag & Drop
Since the CPT Select can be a repeater field, you can add as many post children and sort them as you see fit.
Works With Any Theme
Since this is a standalone plugin, you can swap themes without having to re-do your templates. You’ll only need to do minimal CSS touch-up and you’ll be good to go.
Got you interested? Here’s how to get it
Post To Post Relationships are included with the latest version of WordPress Creation Kit Pro and Lifetime. As always, previous clients will be able to access this via automatic updates or their account page.
Subscribe to get early access
to new plugins, discounts and brief updates about what's new with Cozmoslabs!
This CPT Select is interesting. But I notice you can add a single posttype with another.
Is it possible to make a generic selection to multi posttypes?
Let’s say I have 4 custom posttype of Book, Writer, Publisher and Shop.
I’d like to make a Relationship between a Book and the other three: Writer, Publisher and Shop. All 3 of them! Is this possible?
I think so. You can create a 3 CPT selects, one for each publisher, writer and shop.
The only mention is that it’s going to be a one way relationship (if you want to use Swift Templates). Meaning if you want to do a Swift Template to list publisher and all of their books, it won’t work. You’ll need custom code for that.