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

get_header();
?>

	<main id="primary" class="site-main searchpage pt-5">

	<div class="blog-div container-fluid p-5">
		<?php
            $eco_solar_energy_theme_lay = get_theme_mod( 'eco_solar_energy_theme_options','Right Sidebar');
            if($eco_solar_energy_theme_lay == 'Left Sidebar'){ ?>
                <div class="row m-3">
                    <div class="col-lg-3 col-md-3" id="sidebar"><?php dynamic_sidebar('sidebar-1');?></div>
                    <div id="our-services" class="services col-lg-9 col-md-9">
                        <h1 class="entry-title"><?php /* translators: %s: search term */
                        printf( esc_html__( 'Results For: %s','eco-solar-energy'), esc_html( get_search_query() ) ); ?></h1> 
                        <?php if ( have_posts() ) :
                            /* Start the Loop */
                            while ( have_posts() ) : the_post();
							?>
							<div class="row mainrow m-3">
						
                              <?php  get_template_part( 'template-parts/content',get_post_format()); ?>
								
							</div>	
							<?php
                            endwhile;
							
                            else :
                                get_template_part( 'no-results' ); 
                            endif; 

                        ?>
                    </div>
                </div>
                <div class="clearfix"></div>
            <?php }else if($eco_solar_energy_theme_lay == 'Right Sidebar'){ ?>
                <div class="row m-3">
                    <div id="our-services" class="services col-lg-9 col-md-8"> 
                        <h1 class="entry-title"><?php /* translators: %s: search term */
                        printf( esc_html__( 'Results For: %s','eco-solar-energy'), esc_html( get_search_query() ) ); ?></h1>
                        <?php if ( have_posts() ) :
                        /* Start the Loop */
                            while ( have_posts() ) : the_post();
							?>
							<div class="row mainrow m-3">
							<?php
                                get_template_part( 'template-parts/content',get_post_format()); 
								?>
							</div>	
							<?php
                                // get_template_part( 'template-parts/content',get_post_format()); 
                            endwhile;

                            else :
                                get_template_part( 'no-results' ); 
                            endif; 
                        ?>                       
                      
                    </div>
                    <div class="col-lg-3 col-md-4 mt-5 widget-area search_sidebar" id="sidebar">
                        <?php if (is_active_sidebar('sidebar-1')) {
                            dynamic_sidebar('sidebar-1');                            
                        } else {
                            get_sidebar();
                        }?>
                        </div>
                </div>
            <?php } ?>
			<div class="clearfix"></div>
	</div>

	

	</main><!-- #main -->

<?php
get_footer();
