12% off of LTD using this coupon: TWELVEPERCENTOFF. Promo ends on 2 Dec midnight UTC.
Published on Jul 1, 2019

ACF Relationship field in Oxygen

Sridhar Katakam

Updated on December 15, 2020

In my Facebook group a user asked:

I am working on a site that is linked to motor sports. They have CPT's for Team, Car and Drivers. I was looking to create a template for the team then have a easy post to show the cars relating to that team, I could then also use the same set up to display the drivers of the specific cars. as to the ACF field type I am at the early planning stages so can incorporate any type of field to make it all easier.

This members-only tutorial provides the steps to set up Advanced Custom Fields' Relationship field so site owners can manually select cars that are related to or belong to a specific team and to output them on single team pages using Easy Posts component's posts layout in Oxygen.

Note: The tutorial shows how PHP & HTML from Easy Posts can be used in a Code Block to make the output look like it's from Easy Posts. Easy Posts component itself will not be used.
when editing a "team" entry in the back end
"team" CPT entry page on the front end

Step 1

Create team and car Custom Post Types using a plugin like CPT UI.

Step 2

Add a new custom fields group named say, "Team Meta".

Add a relationship-type field named say, related_cars.

Set the field group to appear on team CPT entry edit screens.

Step 3

Add/edit Team entries and select 1 or more related cars where applicable.

Step 4

Create a Template for single Team entries.

Edit it with Oxygen.

Add a Section where you want to show related cars.

Add a Code Block inside.

PHP:

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.

tagschevron-leftchevron-rightchainangle-rightangle-upangle-downfolder-omagnifiercrossmenuchevron-downarrow-right