This members-only tutorial provides the steps to use Meta Box to set up a relationship between two custom post types, portfolio
and product
and output a list of portfolio items with the related products for each item as an unordered list.


While the tutorial shows implementing this in Oxygen, it can be applied in any WordPress site.
Step 1
Install Meta Box and MB Relationships extension or Meta Box AIO.
Assuming that both the CPTs that you want to connect are already registered and have some items, create a new Relationship at Meta Box > Relationships.
Set the post types in the From and To sections.
Note that the relationship is bi-directional out of the box (what's up ACF?) and "Reciprocal relationship" should not be ticked. That is for relationship between items of the same post type.

Step 2
Edit your portfolio items and assign the corresponding product(s) for each.

Step 3
In this tutorial we are going to output the portfolio CPT items with related products for each item on a static Page.
Create your Page and edit it with Oxygen.
Add a Section and a Code Block inside. Set its width to 100%.
PHP & HTML:
This is a premium members-only content.
To view the rest of the content, please sign up for membership ($47/month or $599 one-time).
Already a member? Log in below or here.