<?php get_header(); ?>

<div id="content">
    <div class="feature-header">
      <div class="feature-post-thumbnail">
        <div class="slider-alternate">
          <img src="<?php echo get_stylesheet_directory_uri() . '/assets/images/header-banner.png'; ?>">
        </div>
        <h1 class="post-title feature-header-title"><?php echo(esc_html_e('Search Result','professional-cleaning-company')); ?></h1>
        <?php if ( get_theme_mod('professional_cleaning_company_breadcrumb_enable',true) ) : ?>
          <div class="bread_crumb text-center">
            <?php professional_cleaning_company_breadcrumb();  ?>
          </div>
        <?php endif; ?>
      </div>
    </div>
  <div class="container">
    <div class="row">
      <?php if(get_theme_mod('professional_cleaning_company_search_sidebar_layout', 'Right Sidebar') == 'Right Sidebar'){ ?>
      <div class="col-lg-9 col-md-8 mt-5">
        <div class="row">
          <?php
            if ( have_posts() ) :

              while ( have_posts() ) :
                the_post();
                ?>
                <div class="col-lg-6 col-md-12 mb-4"> <!-- Each post will take half width -->
                  <?php get_template_part( 'template-parts/content', get_post_format() ); ?>
                </div>
                <?php
              endwhile;

            else:
              get_template_part( 'nothing-found' );

            endif;

            get_template_part( 'template-parts/pagination' );
          ?>
        </div>
      </div>
      <div class="col-lg-3 col-md-4">
        <?php get_sidebar(); ?>
      </div>
      <?php } elseif(get_theme_mod('professional_cleaning_company_search_sidebar_layout', 'Right Sidebar') == 'Left Sidebar'){ ?>
      <div class="col-lg-3 col-md-4">
        <?php get_sidebar(); ?>
      </div>
      <div class="col-lg-9 col-md-8 mt-5">
        <div class="row">
          <?php
            if ( have_posts() ) :

              while ( have_posts() ) :
                the_post();
                ?>
                <div class="col-lg-6 col-md-12 mb-4"> <!-- Each post will take half width -->
                  <?php get_template_part( 'template-parts/content', get_post_format() ); ?>
                </div>
                <?php
              endwhile;

            else:
              get_template_part( 'nothing-found' );

            endif;

            get_template_part( 'template-parts/pagination' );
          ?>
        </div>
      </div>
      <?php } elseif(get_theme_mod('professional_cleaning_company_search_sidebar_layout', 'Right Sidebar') == 'Three Column'){ ?>
      <div class="col-lg-3 col-md-4">
        <?php get_sidebar(); ?>
      </div>
      <div class="col-lg-6 col-md-6 mt-5">
        <?php echo '<h1>' . esc_html__('You searched: ', 'professional-cleaning-company') . get_search_query() . '</h1>'; ?>
        <div class="row">
          <?php
            if ( have_posts() ) :

              while ( have_posts() ) :

                the_post();
                get_template_part( 'template-parts/content' );

              endwhile;

            else:

              get_template_part( 'nothing-found' );

            endif;

            get_template_part( 'template-parts/pagination' );
          ?>
        </div>
      </div>
      <div class="col-lg-3 col-md-4 sidebar-area mt-5">
        <?php dynamic_sidebar('professional-cleaning-company-sidebar-2'); ?>
      </div>
      <?php } elseif(get_theme_mod('professional_cleaning_company_search_sidebar_layout', 'Right Sidebar') == 'Four Column'){ ?>
      <div class="col-lg-3 col-md-4">
        <?php get_sidebar(); ?>
      </div>
      <div class="col-lg-3 col-md-4 sidebar-area mt-5">
        <?php dynamic_sidebar('professional-cleaning-company-sidebar-2'); ?>
      </div>
      <div class="col-lg-3 col-md-4 mt-5">
        <?php echo '<h1>' . esc_html__('You searched: ', 'professional-cleaning-company') . get_search_query() . '</h1>'; ?>
        <div class="row">
          <?php
            if ( have_posts() ) :

              while ( have_posts() ) :

                the_post();
                get_template_part( 'template-parts/content' );

              endwhile;

            else:

              get_template_part( 'nothing-found' );

            endif;

            get_template_part( 'template-parts/pagination' );
          ?>
        </div>
      </div>
      <div class="col-lg-3 col-md-4 sidebar-area mt-5">
        <?php dynamic_sidebar('professional-cleaning-company-sidebar-3'); ?>
      </div>
        <?php } elseif(get_theme_mod('professional_cleaning_company_search_sidebar_layout', 'Right Sidebar') == 'Grid Layout Without Sidebar'){ ?>
        <div class="row mt-5">
            <?php echo '<h1>' . esc_html__('You searched: ', 'professional-cleaning-company') . get_search_query() . '</h1>'; ?>
            <div class="row">
              <?php
                if ( have_posts() ) :

                  while ( have_posts() ) :

                    the_post();
                    get_template_part( 'template-parts/content-grid' );

                  endwhile;

                else:

                  get_template_part( 'nothing-found' );

                endif;

                get_template_part( 'template-parts/pagination' );
              ?>
            </div>
        </div>
        <?php } elseif(get_theme_mod('professional_cleaning_company_search_sidebar_layout', 'Right Sidebar') == 'Grid Layout With Right Sidebar'){ ?>
        <div class="row">
          <div class="col-lg-9 col-md-8 mt-5">
            <?php echo '<h1>' . esc_html__('You searched: ', 'professional-cleaning-company') . get_search_query() . '</h1>'; ?>
            <div class="row">
              <?php
                if ( have_posts() ) :

                  while ( have_posts() ) :

                    the_post();
                    get_template_part( 'template-parts/content-grid' );

                  endwhile;

                else:

                  get_template_part( 'nothing-found' );

                endif;

                get_template_part( 'template-parts/pagination' );
              ?>
            </div>
          </div>
          <div class="col-lg-3 col-md-4">
            <?php get_sidebar(); ?>
          </div>
        </div>
        <?php } elseif(get_theme_mod('professional_cleaning_company_search_sidebar_layout', 'Right Sidebar') == 'Grid Layout With Left Sidebar'){ ?>
        <div class="row">
          <div class="col-lg-3 col-md-4">
            <?php get_sidebar(); ?>
          </div>
          <div class="col-lg-9 col-md-8 mt-5">
            <?php echo '<h1>' . esc_html__('You searched: ', 'professional-cleaning-company') . get_search_query() . '</h1>'; ?>
            <div class="row">
              <?php
                if ( have_posts() ) :

                  while ( have_posts() ) :

                    the_post();
                    get_template_part( 'template-parts/content-grid' );

                  endwhile;

                else:

                  get_template_part( 'nothing-found' );

                endif;

                get_template_part( 'template-parts/pagination' );
              ?>
            </div>
          </div>
        </div>
      <?php } ?>
    </div>
  </div>
</div>
<?php get_footer(); ?>