'articles', 'posts_per_page' => 3, 'orderby' => 'date', 'order' => 'DESC', 'post_status' => 'publish', 'meta_query' => array( array( 'key' => 'related_revue', 'value' => $revueID, 'compare' => '=', ), ), )); $authors = array(); foreach ($revueRelatedArticles->posts as $article) { $currentArticleAuthors = get_field('authors', $article->ID); if (empty($currentArticleAuthors) || !is_array($currentArticleAuthors)) continue; foreach ($currentArticleAuthors as $author) { $authors[] = $author; } } $authors = array_unique($authors); ob_start(); foreach ($authors as $key => $author) { get_template_part( 'template-parts/authors/card-author', null, array( 'ID' => $author->ID, ) ); } $grid_template = ob_get_clean(); return $grid_template; }