<?php


$placeholder_thumbnail_counter = 0;
$carhop_members_by_comity = get_carhop_members_by_comity();
?>
<?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 ($carhop_members_by_comity as $current_comity) : ?>

			<?php $comity_label = $current_comity['label']; ?>

			<div class="comity-type">
				<h3 class="comity-type__title"><?php echo $comity_label; ?></h3>

				<ul class="comity-type__list">
					<?php foreach ($current_comity['members'] as $member) : ?>
						<?php
						$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 endforeach; ?>
				</ul>


			</div>
		<?php endforeach; ?>
		<?php restore_current_blog(); ?>
	</div>
</section>