the answer for all question about Oxygen Builder plugin and WordPress

Dynamically populate an ACF Select field’s choices with CPT entries


Dynamically populate an ACF Select field’s choices with CPT entries
What I am trying to achieve is a Select Box (or similar) of Locations (CPT) on a Team Member’s (CPT) page.
So when you add a Team member you can choose a location to ‘link’ them to.
I have tried to use a Relationship field and also a Post Object field. Both work fine but when I reference those fields in my Oxygen template, all I get is the Post ID or an html link (depending which I choose in the dynamic data option). I just want the name of the location to appear, not “309” etc.
Any ideas how to achieve this?
I am aware of Sridhar’s tutorial but it is premium members only tutorial and I don’t really want to pay $65/mth (AUD) for a code snippet… No offence intended


Source

1 Comment
  1. Alex Tester says

    Post Object is the field for this. Not tested, but you could try using the PHP Dynamic Data option in Oxygen. Then put:

    Top box: get_the_title
    Bottom box: get_field(‘post_object_field’)

    Replace ‘post_object_field’ with your field name, and make sure it’s still set to return the ID in ACF settings.

    And FWIW, Sridhar’s tutorials are a fantastic investment 🙂

Leave A Reply

Your email address will not be published.

Oxyrealm Docs