<?php /* Template Name: Homepage */
    get_header(); ?>
        <section>
        	<!--Slider section start-->
            <div class="banner">            
                <div id="slider-carousel" class="carousel zoomIn garden-slider" data-ride="carousel">
                    <div class="carousel-inner slider">
                        <?php $indicators=0;$eminent_loop_active=0;
                        for($eminent_loop=1 ; $eminent_loop <=5 ; $eminent_loop++):          
                            $sliderimage_image = get_theme_mod ( 'eminent_homepage_sliderimage'.$eminent_loop.'_image');

                            $sliderimage_title = get_theme_mod ( 'eminent_homepage_sliderimage'.$eminent_loop.'_title');
                            $sliderimage_content = get_theme_mod ( 'eminent_homepage_sliderimage'.$eminent_loop.'_subtitle');
                            
                            $sliderimage_link  = get_theme_mod ( 'eminent_homepage_sliderimage'.$eminent_loop.'_link');
                        ?>

                        <?php if($sliderimage_image!=''){
                            $eminent_loop_active++;
                            $sliderimage_image_url = wp_get_attachment_image_src($sliderimage_image,'full');
                        ?>
                        <div class="item <?php if($eminent_loop_active == 1) { echo "active"; } ?>">
                            <?php if($sliderimage_link!='') { ?>
                            
                                <img src="<?php echo esc_url($sliderimage_image_url[0]); ?>" />
                                <div class="effect-hover">
                                    <h3><?php echo esc_html($sliderimage_title); ?></h3>
                                    <p><?php echo esc_html($sliderimage_content);?></p>
                                    <p><a href="<?php echo esc_url($sliderimage_link);?>" target="_blank" rel="noopener"><?php esc_html_e('Read More','eminent'); ?></a></p>
                                </div>
                            
                            <?php } else { ?>                          
                                <img src="<?php echo esc_url($sliderimage_image_url[0]); ?>" />
                                <div class="effect-hover">
                                    <h3><?php echo esc_html($sliderimage_title); ?></h3>
                                </div>
                            <?php } ?>  
                        </div>  
                        <?php $indicators++;}  endfor; ?>
                    </div>
                    <!-- Indicators -->
                    <ol class="carousel-indicators">
                        <?php for($eminent_loop=1 ; $eminent_loop<=$indicators ; $eminent_loop++):  ?>
                        <li data-target="#slider-carousel" data-slide-to="<?php echo esc_attr($eminent_loop-1); ?>"></li>
                        <?php endfor; ?>
                    </ol>
                    <?php if($eminent_loop_active >= 2) { ?>       
                    <a class="left carousel-control slider_button" href="#slider-carousel" data-slide="prev">
                        <i class="fa fa-angle-left"></i>
                    </a>
                    <a class="right carousel-control slider_button" href="#slider-carousel" data-slide="next">
                        <i class="fa fa-angle-right"></i>
                    </a>
                    <?php } ?>
                </div>
            </div>
            <!--blog section start-->
            <div class="section-row portfolio-section col-md-12">
                <div class="container less-padding">
                    <div class="theme-title col-md-8  col-md-offset-2">
                <h2><span>
                      <?php $blog_check = get_theme_mod( 'eminent_blog-title' );
    if(!empty($blog_check)) {
        echo esc_attr( get_theme_mod('eminent_blog-title', '') ); }
                 else {  esc_html_e('Our Blog', 'eminent');  } ?></span></h2>
                <?php $bloginfo_check = get_theme_mod( 'eminent_bloginfo' );
    if(!empty($bloginfo_check)) { ?>
                <p><?php  echo esc_attr( get_theme_mod('eminent_bloginfo', '') ); ?></p>
             <?php } ?>
                    </div>
                    <div class="our-blog col-md-12">
                        <div class="row">
							<?php $eminent_blogcategory=get_theme_mod('eminent_blogcategory');
                            $eminent_args = array(
                            'ignore_sticky_posts' => '1',
                            'meta_query' => array(
                                array(
                                    'key' => '_thumbnail_id',
                                    'compare' => 'EXISTS'
                                ),
                            )
                        );
                if(!empty($eminent_blogcategory))
                    $eminent_args['cat']=$eminent_blogcategory;
                $eminent_query = new WP_Query($eminent_args);
                if ($eminent_query->have_posts()) : while ($eminent_query->have_posts()) : $eminent_query->the_post(); ?>
                            <div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
                                <div class="blog-box">
                                    <div class="post-header">
                                        <div class="post-date">
                                            <p class="date">
												<?php echo esc_html(get_the_time("j")); ?><span><?php echo esc_html(get_the_time(" M")); ?></span> 
											</p>
                                        </div>
                                        <?php if ( has_post_thumbnail() ) : ?>
										<div class="image-wrapper">
											<a href="<?php echo esc_url(get_permalink()); ?>" ><?php the_post_thumbnail( 'eminent-blog-thumbnail-image-home', array( 'alt' => esc_attr(get_the_title()), 'class' => 'img-responsive') ); ?></a>
										</div>
										<?php endif; ?>
                                    </div>
                                    <div class="post-detail">
                                        <div class="blog-title">
                                           <a href="<?php echo esc_url(get_permalink()); ?>" class="post-title"><span><?php the_title();?></span></a>
                                        </div>
                                        <?php eminent_entry_meta();
                                            the_excerpt(); ?>
                                    </div>
                                </div>
                            </div>
                             <?php endwhile;
                                wp_reset_postdata();
                                endif; ?>
                        </div>
                    </div>
                </div>
            </div>    
			 <!--bg section strat-->
			 <?php  $welcome_check = get_theme_mod('eminent_welcometitle');
					$welcome_sub_check = get_theme_mod('eminent_welcome_subtitle');
					$welcomeinfo_check = get_theme_mod('eminent_welcomeinfo');
					if(!empty($welcome_check) || !empty($welcome_sub_check) || !empty($welcomeinfo_check))
					{ ?>
						<div class="section-row welcome-section col-md-12">
							<div class="blur-slider"></div>
							<div class="container less-padding">
								<div class="theme-title col-md-10 col-md-offset-1">
								   <?php $welcome_check = get_theme_mod( 'eminent_welcometitle' );
                                   if(!empty($welcome_check)) { ?>
									<h2><?php echo esc_html( get_theme_mod('eminent_welcometitle', '') ); ?></h2>
									<?php }
                                    $welcome_sub_check = get_theme_mod( 'eminent_welcome_subtitle' );
                                    if(!empty($welcome_sub_check)) { ?>
									<h4><?php echo esc_html( get_theme_mod('eminent_welcome_subtitle', '') ); ?></h4>
									<?php } ?>
									<hr>
									<?php $welcomeinfo_check = get_theme_mod( 'eminent_welcomeinfo' );
                                    if(!empty($welcomeinfo_check)) { ?>
									<p><?php echo esc_textarea( get_theme_mod('eminent_welcomeinfo', '') ); ?></p> <?php } ?>
								</div>
							</div>
						</div>
						<?php } ?>
						<!--bg section-->
        </section>
<?php get_footer();?>