From 4c85c58127715ef165f25b38282ba8bc8212177a Mon Sep 17 00:00:00 2001 From: Nonimart Date: Mon, 6 Oct 2025 11:36:12 +0200 Subject: [PATCH] FIX latest articles --- .../authors/authors-last-publications.php | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/template-parts/authors/authors-last-publications.php b/template-parts/authors/authors-last-publications.php index 3a71eae..5fb5666 100644 --- a/template-parts/authors/authors-last-publications.php +++ b/template-parts/authors/authors-last-publications.php @@ -1,6 +1,6 @@ 'OR'); +foreach ($authors as $author_id) { + $meta_query[] = array( + 'key' => 'authors', + 'value' => '"' . $author_id . '"', // Recherche la valeur sérialisée + 'compare' => 'LIKE' + ); +} + + $authorsLastPosts = get_posts(array( 'post_type' => $isArticle ? 'articles' : 'revues', - 'author' => $authors, 'posts_per_page' => 6, 'orderby' => 'date', 'order' => 'DESC', + 'meta_query' => $meta_query, )); -if (empty($authorsLastPosts)) return; +if (empty($authorsLastPosts) || count($authorsLastPosts) < 2) return; ?>