Home › Forums › General Issues › How to display a wp post from a custom field trigger in custom posts (events) › Reply To: How to display a wp post from a custom field trigger in custom posts (events)
I’m not quite getting it.
In my WP I have two post types – regular posts (WordPress) and event posts (from The Event Calendar pro)
Ive selected a ACF custom field in Custom Fields tab/FieldGroups (given field group a name ‘event_tribe_link’). Ive made a field also called ‘event_tribe_link’, it’s a relationship Field type and Ive checked Post ID as its return format. Maximum = 1. Ive elected Post type as Post (not all or anything else), Filter from Taxonomy is set to All with Post Title and Post Type Checked under ‘Elements’. Conditional logic = No, Location Rule is set to show field if; Post Type is equal to tribe_events.
So hopefully the above is ok so far.
Now when I go to the Event tab in WP and check an event post of say titled “XYZ Event’ I see the field ‘event_tribe_link’ appear followed by a ‘search..’ entry box and below it is a list of all my standard WP posts on which I now can either pick or search and link to the matching post I want to display – in this case Ive selected my related post to be ‘XYZ Post’. Doesn’t this now have the single one-to-one relationship already established or do I need your above code to return the post ID?
Anyway, so all good so far.
Now this is where I get confused. Where would I write your function example and in which php file would I add these statements (if there is a particular one from theme or The Event Calendar Pro)? Should I write these additional statements you suggest to return the post (from the ID relationship Ive selected) so that when I click on the calendar (which would normally take me to the ‘XYZ Event’ and display it) it takes me to the XYZ Post instead – and displays it?
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
© 2022 Advanced Custom Fields.