33 lines
655 B
PHP
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(); ?>
|