Support

Account

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...
      }
    }