<?php
/**
 *
 * @package Luzuk Theme
 */
?>
<?php $showContent = get_theme_mod('lz_fitness_premium_slider_show_content', 'on'); ?> 
<div class="slidercompletesec">
 	<div class="row row-eq-height">
		<div class="col-md-8 col-sm-8 col-xs-12 wow fadeInRight">
			<div class="inside-full-height">
				<div id="ht-home-slider-section">
					<div id="ht-bx-slider">
						<?php
							$args = array( 'post_type' => 'luzuk_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="ht-slide-overlay"></div>
								<?php 
									if(has_post_thumbnail()){
										$total_slider_image = wp_get_attachment_image_src(get_post_thumbnail_id(),'full');	
										echo '<img alt="'. esc_html(get_the_title()) .'" src="'.esc_url($total_slider_image[0]).'">';
									}
									if($showContent == 'on'){
								?>
								<div class="ht-slide-caption">
									<div class="ht-slide-caps-title animated fadeInDown">
										<?php 
										if(has_excerpt()){
											echo get_the_excerpt();
										}else{
											echo lz_fitness_excerpt( get_the_content() , 190 );
										}
										?>
									</div>
									<div class="ht-slide-cap-title animated fadeInDown">
										<?php echo (get_the_title()); ?>
									</div>
									<div class="ht-slide-cap-desc animated fadeInDown">
										<?php echo (get_the_content()); ?>
									</div>					
									<?php 
									if(!empty($pageLink)){ ?>
										<div class="ht-slide-cap-descmore animated fadeInDown">
											<a class="secondry-bg" href="<?php echo $pageLink; ?>"><?php echo($pageLinkTxt); ?></a>
										</div>
									<?php }?>
								</div>
							<?php }?>
						</div>
						<?php
					endwhile;
				}else{ 
					for($i=0;$i<1;$i++){?>
						<div class="ht-slide">
							<div class="ht-slide-overlay"></div>
							<?php echo '<img alt="Slider" src="'. esc_html(get_template_directory_uri()) .'/images/slider-banner.jpg">';?>					
							<?php if($showContent == 'on'){?>
								<div class="ht-slide-caption">
									<div class="ht-slide-caps-title-box animated fadeInDown">
										<div class="ht-slide-caps-title animated fadeInDown">THE NEW</div>
									</div>
									<div class="ht-slide-cap-title animated fadeInDown">COSMETICAL</div>
									<div class="ht-slide-cap-desc animated fadeInDown">UNDER FAVOURABLE <br> CARETOOLS</div>
									<div class="ht-slide-price animated fadeInDown"><sup>$</sup>399</div>
									<div class="ht-slide-cap-descmore animated fadeInDown">	
										<a class="secondry-bg" href="<?php echo $pageLink; ?>"><?php _e( 'Buy Now', 'lz-fintess-premium' ); ?></a> 
									</div> 
								</div>
							<?php }?>
						</div>
					<?php }
				}?>
			</div>
		  </div>
	   </div>
    </div>
	<div class="col-md-4 col-sm-4 col-xs-12 sliderrightbox wow fadeInLeft">
		<div class="inside-full-height">
			<?php
                $static=true;
                for($i=1;$i<3;$i++){
                    $link = get_theme_mod('sliderproduct_category_link'.$i);
                    $img = get_theme_mod('sliderproduct_category_image'.$i);
                    if (!empty($img) || !empty($link)){
                        $static=false;
                    }
                }
                if(function_exists('get_woocommerce_term_meta')){
                    for($i=1;$i<3;$i++){
                        if($static==false){
                            $link = get_theme_mod('sliderproduct_category_link'.$i);
                            $img = get_theme_mod('sliderproduct_category_image'.$i);
                            $url = get_theme_mod('sliderproduct_catelauge_url_'.$i, '#');
                            $category = get_term_by( 'id', $link, 'product_cat' );
                            $img = !empty($img)?$img:get_template_directory_uri().'/images/sliderright1.jpg';

                            if( !empty($url) || !empty($category) ){
                                //echo $term->name;
                                ?>
                                    <a href="<?php echo esc_url(!empty($url)?$url:'#');?>">
                                        <img class="img-responsive sliderright-img" src="<?php echo esc_url($img);?>" alt="" >
                                    </a>
                                    <div class="clearfix"></div>
                                <?php
                            }
                        }
                    }
                    //echo '<div class="clearfix"></div></div>';
                }else{ ?>
                <div class="alert alert-warning">
                    Kindly Install or Activate the WooCommerce plugin.
                </div>
                <?php }
                if($static==true){
                    ?>
                    <div class="slider-rightbox-img1">
                        <a href="#">
                            <img class="img-responsive sliderright-img" src="<?php echo get_template_directory_uri(); ?>/images/sliderright1.jpg" alt="">
                        </a>
                    </div>
                    <div class="slider-rightbox-img2">
                        <a href="#" >
                            <img class="img-responsive sliderright-img sliimg" src="<?php echo get_template_directory_uri(); ?>/images/sliderright2.jpg" alt="" >
                        </a>
                    </div>
                    <?php
                }?>
			</div>
		</div>
	</div>
</div>
