carhop__dynamiques-theme__P.../template-parts/authors/authors-list.php
2025-09-16 14:02:48 +02:00

29 lines
650 B
PHP

<?php
$postId = $args['postId'];
$isArticle = is_singular('articles');
$componentTitle = $isArticle ? 'Auteur·e·s de l\'article' : 'Auteur·e·s de la revue';
$authors = [];
if ($isArticle) {
$authors = get_field('authors', $postId);
} else {
$authors = getRevueAuthors($postId);
}
if (empty($authors)) return;
?>
<section class="authors-list">
<h3 class="authors-list__title"><?php echo $componentTitle; ?></h3>
<?php foreach ($authors as $authorID) : ?>
<?php get_template_part(
'template-parts/authors/card-author',
null,
array(
'ID' => $authorID,
)
); ?>
<?php endforeach; ?>
</section>