Hi,
I have a relationship field that relates an Events
custom post type to Users
. In each user I can select a related event.
I’m building a profile page (frontend author.php
template) where I need to have a field from the related event, specifically a schedule
field.
How can I achieve this? I’ve tried the docs and this forum but my coding skills are weak.
Thanks.
Assuming that the schedule
field is part of the Event
post type, you can grab the schedule this way:
<?php
$event_id = get_field( 'the_users_event_field_name' );
if ( is_object( $event_id ) ) {
$event_id = $event_id->ID;
}
get_field( 'the_schedule_field_name' , $event_id );
Hi Daniel,
Thanks for your help. I’m yet to make it work. Need a little more time to tweak with your code to find the solution.
I’ll post it here as soon as I find the problem.
Thanks again!