<?php
/**
 *
 * @package Slider Premium
 */
?>

<div class="slider-c-area">
	<div class="container">
		<div class="row row-eq-height">
			<div class="col-md-3 col-sm-3 col-xs-12">
				<div class="inside-full-height slider-procat">
					<?php
						$luzuk_popular_cattitle = get_theme_mod('luzuk_popular_cattitle', ' Popular Categories');
					?>
					<div class="popular-catt">
						<?php echo ($luzuk_popular_cattitle);  ?></div>

					<?php
						$args =array(
							'taxonomy'=>'product_cat',
							'hide_empty' => false
						);
						$results= get_terms($args);
					?>
						<?php

					 	foreach ($results as $cat) {
				 		$term_link = get_term_link( $cat,'product_cat' );

					 	$cond= $cat-> slug ;
					 	for ( $count = 1; $count <= 10; $count++ ) {
						get_theme_mod('slider_product_category'. $count);
					 	if ( $cond ===  get_theme_mod('slider_product_category'. $count)) {
					 		?>
					 		<li class="center" id="product-image">
				 				<a href="<?php echo $term_link; ?>" class="product-category">
				 					<?php 
				 					echo $cat-> name .'';
				 				?>
				 				</a>
					 		</li>
					 		<?php
					 		} //condition ends
					 	} // count loop ends
					 	} // foreach loop ends
					?>
				</div>
			</div>
			<div class="col-md-9 col-sm-9 col-xs-12">
				<div class="inside-full-height">
					<?php $showContent = get_theme_mod('premium_slider_show_content', 'on'); ?>
					<div class="slider_section" id="slider">
						<div id="ht-bx-slider">
							<?php
								$args = array( 'post_type' => 'slider', 'orderby'   => 'id', 'order' => 'DESC', );
								if(!empty($pageId)){
									$args['page_id'] = absint($pageId);

								}
								$text = '';
								$query = new WP_Query($args);
								if($query->have_posts()){
									while($query->have_posts()) : $query->the_post(); 
										$pageLink = '';
										$slider_btn_link = get_post_meta($post->ID,'slider_btn_link',false);
										$sliderBtnTxt = get_post_meta($post->ID,'sliderBtnTxt',false);
										if(!empty($slider_btn_link) && is_array($slider_btn_link)){
											$pageLink = get_category_link($slider_btn_link[0]);
										}
										if(!empty($sliderBtnTxt) && is_array($sliderBtnTxt)){
											$pageLinkTxt = $sliderBtnTxt[0];
										}else{
											$pageLinkTxt = 'Shop Now';
										}
										?>
									<div class="ht-slide">
											<div class="sliderimg">
													<?php 
												if(has_post_thumbnail()){
													$total_slider_image = wp_get_attachment_image_src(get_post_thumbnail_id(),'full');	
													echo '<img class="slide-mainimg" alt="'. esc_html(get_the_title()) .'" src="'.esc_url($total_slider_image[0]).'">';
												}?>
											</div>
										<?php
										if($showContent == 'on'){
											?>
											<div class="slider_content">
												<div class="sub-title animated fadeInLeftBig">
													<?php echo (get_the_content()); ?>
												</div>	
												<div class="title animated fadeInDownBig">
													<?php echo (get_the_title()); ?>
												</div>
												<?php 
												if(!empty($pageLink)){ ?>
													<div class="slider-btn wow fadeInDown">
														<div class="s-btn"></div>
														<a class="btn btn-lg" href="<?php echo $pageLink; ?>"><?php echo($pageLinkTxt); ?></a>
													</div>
												<?php }?>
											</div>
											<?php }?>
										</div>
										<?php
									endwhile;
								}else{ 
									for($i=0;$i<2;$i++){?>
									<div class="ht-slide">
										<div class="sliderimg">
											<?php echo '<img class="slide-mainimg" alt="Slider" src="'. esc_html(get_template_directory_uri()) .'/images/slider.jpg">';?>
										</div>
										<?php if($showContent == 'on'){?>
										<div class="slider_content">
										
										<div class="sub-title animated fadeInLeftBig">New Arrivals 2020</div>
										<div class="title animated fadeInDownBig">Mid Season Sale Up to 60%</div>	
											<div class="slider-btn wow fadeInDown">
												<div class="s-btn"></div>
												<a class="btn btn-lg" href="#"><?php _e( 'Shop Now', 'luzuk-premium' ); ?></a>
											</div>
										
										</div>
										<?php }?>
									</div>
									<?php }
								}?>
							</div>
						</div>
					</div>
				</div>
				<div class="clearfix"></div>
			</div>
		</div>
	<div class="clearfix"></div>
</div>