<?php

/**
 * The template for displaying search results pages.
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#search-result
 *
 * @package cleanlogic
 */

get_header(); ?>

<section id="primary" class="content-area">
	<main id="main" class="site-main" role="main">

		<?php
		if (have_posts()) : ?>

			<header class="page-header">
				<?php
				// translators: %s: search query.
				$search_string = esc_html__('Search Results for: %s', 'cleanlogic');

				$search_title = sprintf(
					$search_string,
					'<span>' . esc_html(get_search_query()) . '</span>'
				);

				echo '<h1 class="page-title">' . wp_kses_post($search_title) . '</h1>';
				?>
			</header><!-- .page-header -->

		<?php
			/* Start the Loop */
			while (have_posts()) : the_post();
				get_template_part('template-parts/content', 'search');

			endwhile;

			the_posts_pagination(
				array(
					'mid_size'           => 2,
					'prev_text'          => esc_html_x( '« Previous', 'previous posts', 'cleanlogic' ),
					'next_text'          => esc_html_x( 'Next »', 'next posts', 'cleanlogic' ),
					'screen_reader_text' => esc_html__( 'Search navigation', 'cleanlogic' ),
				)
			);

		else :

			get_template_part('template-parts/content', 'none');

		endif; ?>

	</main><!-- #main -->
</section><!-- #primary -->

<?php
get_sidebar();
get_footer();
