carhop__dynamiques-theme__P.../single-auteurs.php
Nonimart baa799458b
All checks were successful
continuous-integration/drone/push Build is passing
FEATURE Showing commity if personn is part of a commity
2025-09-16 16:11:11 +02:00

93 lines
2.2 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'] ?? '';
$comity = get_field('comity', $author_id);
?>
<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>
<div class="infos">
<p><?php echo $description; ?></p>
<?php if ($comity) : ?>
<p class="page--single-auteurs__comities-list">
<span class="page--single-auteurs__comities-list-title">
membre de :
</span>
<?php foreach ($comity as $comity_value) : ?>
<?php
$comities = get_field_object('comity');
$comity_label = $comities['choices'][$comity_value] ?? null;
?>
<?php if ($comity_label) : ?>
<span class="page--single-auteurs__comity"><?php echo $comity_label ?></span>
<?php endif; ?>
<?php endforeach; ?>
</p>
<?php endif; ?>
</div>
</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();