<?php

/**
 * Displays the actu part
 *
 * @package WordPress
 * @subpackage IZI_THEME
 * @since 1.0.0
 */
?>
<!-- ACTU BEGIN -->
<section class="container my-5">
	<h2 class="htitles text-end mb-5">L'actu des séries</h2>
	<div class="row">
		<?php
		$args = array(
			'category_name' 	=> 'actu-series',
			'posts_per_page' 	=> 3
		);
		$recentPosts = new WP_Query($args);

		if ($recentPosts->have_posts()) : while ($recentPosts->have_posts()) : $recentPosts->the_post();
		?>



		<div class="col-12 col-lg-4">
			<div class="card border-0 mb-4">
			<?php
				if (has_post_thumbnail()) {
					the_post_thumbnail('cat-thumb', ['class' => 'img-fluid w-100']); 
				} else {
					echo '<img src="' . get_template_directory_uri() . '/assets/img/actu/fallout-serie-tv.jpg" class="img-fluid w-100" alt="Actu Séries" loading="lazy">';
				}
			?>
				<div class="card-body">
					<h3 class="card-title text-dark newstitle"><?php the_title(); ?></h3>
					<p class="card-text"><?php echo get_the_excerpt(); ?></p>
					<div class="d-grid gap-2 d-lg-flex justify-content-lg-end">
						<a href="<?php the_permalink(); ?>" class="underline-gradient fw-bolder">lire la suite...</a>
					</div>
				</div>
			</div>
		</div>
		<?php endwhile;
		else : ?>
			<div class="article-content">
				<p>Aucun contenu à afficher</p>
			</div>
		<?php endif;
		// Restore original post data.
		wp_reset_postdata();
		?>

		<div class="d-grid gap-2 d-lg-flex justify-content-lg-center">
			<a href="#" class="btn btn-gradient btn-border" role="button" aria-pressed="true">voir
				plus...</a>
		</div>
	</div>
</section>
<!-- ACTU END -->