carhop__dynamiques-theme__P.../template-parts/authors/authors-list.php
Nonimart a6163692fe
All checks were successful
continuous-integration/drone/push Build is passing
FEATURE Introducing revue toolbar
2025-08-21 17:19:15 +02:00

31 lines
826 B
PHP

<?php
$postId = $args['postId'];
$isArticle = is_singular('articles');
$componentTitle = $isArticle ? 'Auteur·e·s de l\'article' : 'Auteur·e·s de la revue';
$articleTitle = get_the_title($postId);
$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 if ($isArticle && $articleTitle) : ?>
<p class="authors-list__article-title"><?php echo $articleTitle; ?></p>
<?php endif; ?>
<?php foreach ($authors as $authorID) : ?>
<?php get_template_part(
'template-parts/authors/card-author',
null,
array(
'ID' => $authorID,
)
); ?>
<?php endforeach; ?>
</section>