<?php

$args = array(
	'post_type' => 'post',
	'posts_per_page' => 8,
);
$query = new WP_Query($args);


?>
<section <?php echo get_block_wrapper_attributes(); ?>>
	<h2>Dernières actualités</h2>
	<?php if ($query->have_posts()) : ?>
		<div class="swiper latest-news-swiper">
			<div class="swiper-wrapper">
				<?php while ($query->have_posts()) : $query->the_post(); ?>
					<div class="swiper-slide">
						<article class="news-card">
							<?php if (has_post_thumbnail()) : ?>
								<div class="news-image">
									<?php the_post_thumbnail('medium'); ?>
								</div>
							<?php endif; ?>
							<div class="news-content">
								<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
								<div class="news-excerpt">
									<?php the_excerpt(); ?>
								</div>
							</div>
						</article>
					</div>
				<?php endwhile; ?>
			</div>
			<div class="swiper-pagination"></div>
			<div class="swiper-button-next"></div>
			<div class="swiper-button-prev"></div>
		</div>


	<?php endif; ?>
</section>