<?php
/**
 * The template for displaying search results pages.
 *
 * @package bootstrap_coach
 */

get_header();

$layout = bootstrap_coach_get_sidebar_layout();
if( $layout == 'no-sidebar' ) {
  $content_column_class = 'col-sm-12';
} else {
  $content_column_class = 'col-sm-8';
}
?>

<div class="search-page inside-page" id="primary">
  <div class="container">
    <header class="page-header">
        <h1 class="page-title">
         <?php
         /* translators: %s: search query. */
         printf( esc_html__( 'Search Results for: %s', 'default' ), '<span>' . get_search_query() . '</span>' );
         ?>
       </h1>
     </header>
    <div class="row">

      <?php if ( $layout == 'left-sidebar' ) : ?>
        <div class="col-sm-4"><?php get_sidebar(); ?></div>
      <?php endif; ?>

      <div class="<?php echo esc_attr( $content_column_class ); ?>">
        <?php if ( have_posts() ) : ?>
          <?php /* Start the Loop */ ?>
          <?php while ( have_posts() ) : the_post(); ?>
            <?php get_template_part( 'template-parts/content' ); ?>
          <?php endwhile; ?>                  
          
          <?php else : ?>
            <?php get_template_part( 'template-parts/content', 'none' ); ?>
          <?php endif; ?>
      </div>  

      <?php if( $layout == 'right-sidebar' ) : ?>
        <div class="col-sm-4"><?php get_sidebar(); ?></div>
      <?php endif; ?>

    </div>
  </div>
</div>
<?php get_footer();