<?php
/**
 * Search results template.
 *
 * @package EasySite_Pro
 */

get_header();
?>

<div class="easysite-container easysite-content-area">
	<header class="easysite-page-header">
		<h1 class="easysite-page-title">
			<?php
			printf(
				/* translators: %s: search query */
				esc_html__( 'Search results for: %s', 'easysite-pro' ),
				'<span>' . esc_html( get_search_query() ) . '</span>'
			);
			?>
		</h1>
	</header>

	<?php if ( have_posts() ) : ?>
		<div class="easysite-posts-list">
			<?php while ( have_posts() ) : the_post(); ?>
				<article <?php post_class( 'easysite-search-item' ); ?>>
					<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
					<p><?php echo esc_html( wp_trim_words( get_the_excerpt(), 30 ) ); ?></p>
				</article>
			<?php endwhile; ?>
		</div>
		<?php the_posts_pagination(); ?>
	<?php else : ?>
		<p><?php esc_html_e( 'Sorry, nothing matched your search. Please try again.', 'easysite-pro' ); ?></p>
		<?php get_search_form(); ?>
	<?php endif; ?>
</div>

<?php
get_footer();
