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

get_header(); ?>

<?php if ( get_theme_mod( 'culinary_header_sidebar_search' ) ) { ?>

	<div class="header-widget-wrap">

		<div class="row">


		</div><!-- .row -->

	</div><!-- .header-widget -->

<?php } // end header_sidebar_search ?>

<div class="row">

	<?php $sidebar_layout = get_theme_mod( 'culinary_sidebar_layout', 'right-sidebar' ); ?>
	
	<?php if ( $sidebar_layout == "left-sidebar" ) { ?>

		<div class="large-3 columns small-12">
			<?php get_sidebar(); ?>
		</div><!-- .large-3 -->

	<?php } ?> 

	<div id="primary" class="content-area large-8 small-12 <?php if ( $sidebar_layout == "left-sidebar" ) { echo "large-offset-1"; } ?> columns">

			<main id="main" class="site-main" role="main">

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

				<header class="page-header">
					<h2 class="page-title"><?php printf( esc_html__( 'Search Results for: %s', 'culinary' ), '<span>' . get_search_query() . '</span>' ); ?></h2>
				</header><!-- .page-header -->

				<?php /* Start the Loop */ ?>
				<?php while ( have_posts() ) : the_post(); ?>

					<?php
					/**
					 * Run the loop for the search to output the results.
					 * If you want to overload this in a child theme then include a file
					 * called content-search.php and that will be used instead.
					 */
					get_template_part( 'template-parts/content', 'search' );
					?>

				<?php endwhile; ?>

				<?php culinary_paging_nav(); ?>

			<?php else : ?>

				<?php get_template_part( 'template-parts/content', 'none' ); ?>

			<?php endif; ?>

			</main><!-- #main -->
		
	</div><!-- .large-8 -->

	<?php if ( $sidebar_layout == "right-sidebar" ) { ?>

		<div class="large-3 large-offset-1 small-12 columns">
			<?php get_sidebar(); ?>
		</div><!-- .large-3 -->

	<?php } ?> 

</div><!-- .row -->

<?php get_footer(); ?>