FEATURE Introducing the component
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
86fd29864c
commit
2f495878c3
33
template-parts/authors/authors-last-publications.php
Normal file
33
template-parts/authors/authors-last-publications.php
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?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(); ?>
|
||||||
Loading…
Reference in New Issue
Block a user