REFACTOR
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Antoine M 2026-03-04 11:21:55 +01:00
parent 25ada448e1
commit 87d2189f55

View File

@ -2,67 +2,37 @@
$placeholder_thumbnail_counter = 0;
switch_to_blog(1);
$comities_field_object = get_field_object('field_699737b48c0d2');
$comities = $comities_field_object ? $comities_field_object['choices'] : [];
restore_current_blog();
$carhop_members_by_comity = get_carhop_members_by_comity();
?>
<?php switch_to_blog(1); ?>
<?php switch_to_blog(new_blog_id: 1); ?>
<section class="team-authors content-section alignwide">
<h2 class="title-small">Équipe dynamiques</h2>
<h3 class="subtitle-big">À la croisée des plumes et des luttes</h3>
<div class="container">
<?php foreach ($comities as $comity_value => $comity_label) : ?>
<?php foreach ($carhop_members_by_comity as $current_comity) : ?>
<?php $comity_label = $current_comity['label']; ?>
<?php
$comities_related_members = new WP_Query(array(
'post_type' => 'equipe',
'posts_per_page' => -1,
'meta_key' => 'last_name',
'orderby' => 'meta_value',
'order' => 'ASC',
'meta_query' => array(
array(
'key' => 'comity',
'value' => $comity_value,
'compare' => 'LIKE',
),
array(
'key' => 'is_part_of_dynamiques',
'value' => true,
'compare' => 'LIKE',
),
),
));
if (!$comities_related_members->have_posts()) continue;
?>
<?php restore_current_blog(); ?>
<div class="comity-type">
<h3 class="comity-type__title"><?php echo $comity_label; ?></h3>
<ul class="comity-type__list">
<?php while ($comities_related_members->have_posts()) : $comities_related_members->the_post(); ?>
<?php foreach ($current_comity['members'] as $member) : ?>
<?php
$memberID = get_the_ID();
$is_part_of_dynamiques = get_field('is_member_of', $memberID);
$memberID = $member->ID;
switch_to_blog(1);
$is_part_of_dynamiques = get_field('is_part_of_dynamiques', $memberID);
restore_current_blog();
if (!$is_part_of_dynamiques) continue;
?>
<?php get_template_part('template-parts/components/cards/member-card', '', array('member_id' => $memberID, 'redirect_to_author_page' => true)); ?>
<?php endwhile; ?>
<?php endforeach; ?>
</ul>
</div>
<?php endforeach; ?>
<?php restore_current_blog(); ?>
</div>
</section>