Home › Forums › Front-end Issues › Get Relationship from another Relationship › Reply To: Get Relationship from another Relationship
What you need to do is collect a list of posts, making sure you don’t have duplicates in the first loop and then show them in a different loop.
so, in your nested loop
if($items) {
$collected_artists= array();
foreach ($items as $item) {
// see if we already have this one
if (!is_array($item->ID, $collected_artists)) {
// don't have it, add to list
$collected_artists[] = $item->ID;
}
} // end foreach $item
} // end if items
// Loop over $collected artists and show data for each
if ($collected_artists) {
foreach ($collectec_artists as $artist_id) {
// etc...
}
}
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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.