Accessing the information in an ACF bidirectional relationship field array

Hi
I have created 3 custom post types using ACFpro Events, Venues and Artists. With this forums help i have setup the an events archive page that displays the Events information including the artist and the venue which is done using ACFs relationship filed.
I now need to create both artist and venue archive pages that will show the events being performed by an artist or list the events being performed at a venue. I have enabled Bidirectional in ACF under advanced and i can see the events under both venues and artists in the dash but i am unsure how to access and display this in the archive layout using dynamic content.

The image below shows the events being listed, as well as the Post Metadata events field array content

array (
0 =>
array (
0 => ‘80’,
1 => ‘37’,
2 => ‘84’,
),
)

can you please advise how i can display this information in the archive

many thanks
Richard

Hello Richard,

Thank you for the inquiry.

Have you tried creating a Looper Provider > Dynamic Content with the value of the post meta events? Under this provider, you can create another Looper Provider that uses the event’s ID.

Let us know if you need more info.

Best regards.

So i have a Section with a looper provider of Artists, i then have a column set as a looper consumer which displays the artists name. Inside that column i have a Div with a looper provider setup as Dynamic content with input of {{ acf.post_field({“field”:“events”}) }} When i try to access the array i just get the word array returned.

I obviously need to feed {{ acf.post_field({“field”:“events”}) }} into another loop to expand the array but this seems to be where i get stuck

Thank you for the info.

We may need to access the site in order check this further. Please provide the login details in the secure note.

Have you tried creating another Looper Provider accessing the content of the {{ looper.item }} or {{ dc:looper:item }}? This should contain the array of events if we’re not mistaken.

Testing page is here https://tcfdev.xyz/?page_id=86

Thank you for the info.

Instead of creating another Looper Provider, we just created a Twig template.

Let us know if you need more info.

Warm regards.

We updated the Twig template to fetch the acf.post_field({“field”:“events”}).

Hi Ismael
Thanks, this is my first experience with twig so forgive me if i ask some silly questions. Now i can see the information in the array i am assuming i can feed that into a looper provider as dynamic content and then use it in my layout in the usually way. Ultimately i want the band name and then a list of events that are performing i.e. venue name date of event time of event

array(3) {
     [0] =>  object(WP_Post) #11579 (24) { ["ID"]= > int(80) ["post_author"] =>  string(1) "1" ["post_date"] =>  string(19) "2025-03-03 16:28:08" ["post_date_gmt"] =>  string(19) "2025-03-03 16:28:08" ["post_content"] =>  string(0) "" ["post_title"] =>  string(33) "event 5 at the foxlow with Band D" ["post_excerpt"] =>  string(0) "" ["post_status"] =>  string(7) "publish" ["comment_status"] =>  string(6) "closed" ["ping_status"] =>  string(6) "closed" ["post_password"] =>  string(0) "" ["post_name"] =>  string(33) "event-5-at-the-foxlow-with-band-d" ["to_ping"] =>  string(0) "" ["pinged"] =>  string(0) "" ["post_modified"] =>  string(19) "2025-03-03 16:30:35" ["post_modified_gmt"] =>  string(19) "2025-03-03 16:30:35" ["post_content_filtered"] =>  string(0) "" ["post_parent"] =>  int(0) ["guid"] =>  string(45) "https://tcfdev.xyz/?post_type=event&p=80" ["menu_order"] =>  int(0) ["post_type"] =>  string(5) "event" ["post_mime_type"] =>  string(0) "" ["comment_count"] =>  string(1) "0" ["filter"] =>  string(3) "raw"
} [1] =>  object(WP_Post) #11589 (24) { ["ID"]= > int(37) ["post_author"] =>  string(1) "1" ["post_date"] =>  string(19) "2025-02-27 10:13:26" ["post_date_gmt"] =>  string(19) "2025-02-27 10:13:26" ["post_content"] =>  string(0) "" ["post_title"] =>  string(13) "Blues Event 4" ["post_excerpt"] =>  string(0) "" ["post_status"] =>  string(7) "publish" ["comment_status"] =>  string(6) "closed" ["ping_status"] =>  string(6) "closed" ["post_password"] =>  string(0) "" ["post_name"] =>  string(7) "event-4" ["to_ping"] =>  string(0) "" ["pinged"] =>  string(0) "" ["post_modified"] =>  string(19) "2025-03-03 16:48:16" ["post_modified_gmt"] =>  string(19) "2025-03-03 16:48:16" ["post_content_filtered"] =>  string(0) "" ["post_parent"] =>  int(0) ["guid"] =>  string(45) "https://tcfdev.xyz/?post_type=event&p=37" ["menu_order"] =>  int(0) ["post_type"] =>  string(5) "event" ["post_mime_type"] =>  string(0) "" ["comment_count"] =>  string(1) "0" ["filter"] =>  string(3) "raw"
} [2] =>  object(WP_Post) #11582 (24) { ["ID"]= > int(84) ["post_author"] =>  string(1) "1" ["post_date"] =>  string(19) "2025-03-04 11:19:21" ["post_date_gmt"] =>  string(19) "2025-03-04 11:19:21" ["post_content"] =>  string(0) "" ["post_title"] =>  string(9) "new event" ["post_excerpt"] =>  string(0) "" ["post_status"] =>  string(7) "publish" ["comment_status"] =>  string(6) "closed" ["ping_status"] =>  string(6) "closed" ["post_password"] =>  string(0) "" ["post_name"] =>  string(9) "new-event" ["to_ping"] =>  string(0) "" ["pinged"] =>  string(0) "" ["post_modified"] =>  string(19) "2025-03-04 11:19:35" ["post_modified_gmt"] =>  string(19) "2025-03-04 11:19:35" ["post_content_filtered"] =>  string(0) "" ["post_parent"] =>  int(0) ["guid"] =>  string(45) "https://tcfdev.xyz/?post_type=event&p=84" ["menu_order"] =>  int(0) ["post_type"] =>  string(5) "event" ["post_mime_type"] =>  string(0) "" ["comment_count"] =>  string(1) "0" ["filter"] =>  string(3) "raw"
}
}

I have formated the contents of the array to make it easier to read. I can see the event post IDs i need so should i then be using a twig statement somthink like the statement you advised me to use in a previous post (ACF relationship field returning post id number)
{% set venue = get_post({{ ID_HERE }}) %} {{ venue.address }}

If so how do i feed the 3 ids from the events array into this statement

sorry for the seemingly basic questions but this is my first trip down the rabbit hole of Twig. Once i have a working example of how twig works with posts and ACF fields i should be able to expand my knowledge from the ThemeCo documentation. Hopefully a MAX series is in production for twig.

thanks again for any help and advice you can give
Richard

Thank you for the update.

Yes, you can use the get_post function to retrieve the venue and any related post type. We adjusted the Looper Providers in the test page and added the corresponding Twig templates.

Let us know if you need additional info.

Warm regards.