carhop__dynamiques-theme__P.../template-parts/authors/authors-last-publications.php
Nonimart 2f495878c3
All checks were successful
continuous-integration/drone/push Build is passing
FEATURE Introducing the component
2025-06-25 11:45:25 +02:00

33 lines
655 B
PHP

<?php
$postId = $args['postId'];
$authors = [];
$isArticle = is_singular('articles');
if ($isArticle) {
$authors = get_field('authors', $postId);
} else {
$authors = getRevueAuthors($postId);
}
if (empty($authors)) return;
$authorsLastPosts = get_posts(array(
'post_type' => $isArticle ? 'articles' : 'revues',
'author' => $authors,
'posts_per_page' => 6,
'orderby' => 'date',
'order' => 'DESC',
));
?>
<?php foreach ($authorsLastPosts as $post) : ?>
<?php get_template_part('template-parts/articles/card-article', null, array(
'ID' => $post->ID,
)); ?>
<?php endforeach; ?>
<?php wp_reset_postdata(); ?>