<?php

/**
 * Displays the search result
 *
 * @package WordPress
 * @subpackage IZI_THEME
 * @since 1.0.0
 */
get_header();
?>

	<!-- /* INTERNAL PAGE HEADER IMG -->
	<div class="container-fluid p-0 position-relative pagehead">
		<div class="filterdiv internalpage position-absolute top-0 start-0"></div>
		<?php
			if (has_post_thumbnail()) {
				the_post_thumbnail('full', ['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>
	<!-- IMG END -->

	<!-- PAGE CONTENT -->
	<section class="container mt-5">
		<h1 class="htitles text-center my-5"><?php if ( !is_search() ) { the_title(); } else { printf(esc_html__('Résultats de la recherche : %s'), ' '. get_search_query() ); } ?></h1>
		<div class="row justify-content-md-center g-0">
			<?php
			if ( have_posts() ) : while ( have_posts() ) : the_post();
			?>
			<div class="col-lg-8 col-xl-9 mb-4">
				<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" class="mt-3"><h2><?php the_title(); ?></h2></a>
			</div>
			<?php
			endwhile; else:
				echo 'Désolé, aucun résultat pour cette recherche ! Effectuez une nouvelle recherche : <br>';
                get_search_form();
			endif;
			wp_reset_postdata();
			?>
		</div>
	</section>
	<!-- PAGE CONTENT END -->

<?php
get_template_part('template-parts/content-videobg');
get_template_part('template-parts/content-prefooter');
get_footer();