carhop__dynamiques-theme__P.../single-auteurs.php
Nonimart 107673517e
All checks were successful
continuous-integration/drone/push Build is passing
FEATURE Handling single authors
2025-09-16 15:28:37 +02:00

69 lines
1.6 KiB
PHP

<?php
get_header();
$author_id = get_the_ID();
$description = get_field('description', $author_id);
$profilePicture = get_field('profile_thumbnail', $author_id);
$profilePictureUrl = $profilePicture['url'] ?? '';
$profilePictureAlt = $profilePicture['alt'] ?? '';
?>
<div class="page--single-auteurs" data-author-id="<?php echo $author_id; ?>">
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div class="page--single-auteurs__header">
<h1 class="page--single-auteurs__title"><?php the_title(); ?></h1>
<div class="author-card__profile-picture">
<?php if ($profilePictureUrl) : ?>
<img src="<?php echo $profilePictureUrl; ?>" alt="<?php echo $profilePictureAlt; ?>">
<?php else : ?>
<div class="author-card__profile-picture-placeholder">
</div>
<?php endif; ?>
</div>
<p><?php echo $description; ?></p>
</div>
<?php
$authorArticles = get_posts(array(
'post_type' => 'articles',
'posts_per_page' => -1,
'meta_query' => array(
array(
'key' => 'authors', // Ajustez selon votre structure
'value' => $author_id,
'compare' => 'LIKE'
)
),
));
?>
<ul class="post-grid__list">
<?php foreach ($authorArticles as $article) : ?>
<?php get_template_part('template-parts/articles/card-article', null, array(
'ID' => $article->ID,
'showAuthors' => true,
)); ?>
<?php endforeach; ?>
</ul>
<?php endwhile; ?>
<?php endif; ?>
</div>
<?php
get_footer();