FEATURE Refining the component aspect
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Antoine M 2025-06-30 17:54:13 +02:00
parent 3af7d828c9
commit bb842dedc4

View File

@ -4,6 +4,9 @@ $comities_field_object = get_field_object('field_6836da6d03ff6');
$comities = $comities_field_object ? $comities_field_object['choices'] : [];
$field_auteurs = get_field_object('auteurs', 'group_auteurs');
$placeholder_thumbnail_counter = 0;
$authors = get_posts(array(
'post_type' => 'auteurs',
@ -20,9 +23,6 @@ $authors = get_posts(array(
<div class="container">
<?php foreach ($comities as $comity_value => $comity_label) : ?>
<div class="comity-type">
<h3 class="comity-type__title"><?php echo $comity_label; ?></h3>
<?php $comities_related_authors = get_posts(array(
'post_type' => 'auteurs',
'posts_per_page' => -1,
@ -32,28 +32,40 @@ $authors = get_posts(array(
array(
'key' => 'comity',
'value' => $comity_value,
'compare' => '=',
'compare' => 'LIKE',
),
),
)); ?>
));
if (count($comities_related_authors) < 1) continue;
?>
<div class="comity-type">
<h3 class="comity-type__title"><?php echo $comity_label; ?></h3>
<ul class="comity-type__list">
<?php foreach ($comities_related_authors as $author) : ?>
<?php
$author_thumbnail = get_field('profile_thumbnail', $author->ID);
$author_description = get_field('description', $author->ID);
$author_email = get_field('email', $author->ID);
?>
<li class="comity-type__item author-card ">
<div class="author-card__thumbnail">
<div class="author-card__profile-picture">
<?php if ($author_thumbnail) : ?>
<img src="<?php echo $author_thumbnail['url']; ?>" alt="<?php echo $author_thumbnail['alt']; ?>">
<?php else : ?>
<img src="<?php echo get_template_directory_uri(); ?>/assets/images/placeholder-author.png" alt="Placeholder author">
<div class="author-card__profile-picture-placeholder lol author-card__profile-picture-placeholder--<?php echo $placeholder_thumbnail_counter % 3 + 1; ?>n">
<!-- <img class="" src="<?php echo get_template_directory_uri(); ?>/assets/images/placeholder-author.png" alt="Placeholder author"> -->
</div>
<?php $placeholder_thumbnail_counter++; ?>
<?php endif; ?>
</div>
<h4 class="author-card__name"><?php echo $author->post_title; ?></h4>
<p class="author-card__bio"><?php echo $author_description; ?></p>
<?php if ($author_email) : ?>
<a href="mailto:<?php echo $author_email; ?>" class="author-card__email cta cta--classic cta--rounded cta--has-icon cta--mailing">
@ -67,6 +79,8 @@ $authors = get_posts(array(
</a>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>