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

<?php $showContent = get_theme_mod('premium_slider_show_content', 'on'); ?>
<div id="ht-home-slider-section">
	<?php if( get_theme_mod('circle_image_display','show' ) == 'show') : ?>
		<div class="slider-circle sec-blob">
			<?php 
				$circle_image = get_theme_mod('circle_image');
				if(!empty($circle_image)){
					echo '<img alt="'. esc_html(get_the_title()) .'" src="'.esc_url($circle_image).'" class="img-responsive secondry-bg-img" />';
				}else{
					echo '<img alt="sldercircle sign" src="'.get_template_directory_uri().'/images/seccircle.png" class="img-responsive" />';
				}
			?>
		</div>
	<?php endif ?>
	<!-- <div class="ht-slide-overlay"></div> -->
	<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 = esc_url(get_permalink($slider_btn_link[0]));
				}
				if(!empty($sliderBtnTxt) && is_array($sliderBtnTxt)){
					$pageLinkTxt = $sliderBtnTxt[0];
				}else{
					$pageLinkTxt = 'Start Free Trial';
				}
				?>
				<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="ht-slide-caption wow zoomIn ">
							<div class="ht-slide-cap-desc">
								<?php echo (get_the_title()); ?>
							</div>		
							<div class="ht-slide-cap-title">
								<?php echo (get_the_content()); ?>
							</div>
											
							<?php 
							if(!empty($pageLink)){ ?>
							<div class="sliderbtn">	
								<div class="ht-slide-cap-descmore">
									<a class="secondry-bg" href="<?php echo $pageLink; ?>"><?php echo($pageLinkTxt); ?><i class="fa fa-angle-double-right"></i></a>
								</div>
							</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/sliderbx.jpg">';?>
					</div>

					<?php if($showContent == 'on'){?>
					<div class="ht-slide-caption zoomIn">
					<div class="ht-slide-cap-desc">Heading Here</div>
					<div class="ht-slide-cap-title">Transform & Grow Your Business </div>
					
					<div class="sliderbtn">	
						<div class="ht-slide-cap-descmore">	
							<a class="secondry-bg" href="<?php echo $pageLink; ?>"><?php _e( 'Read More', 'luzuk' ); ?><i class="fa fa-angle-double-right"></i></a>
						</div>
					</div>
					</div>
					<?php }?>
				</div>
				<?php }
			}?>
		</div>
		
	</div>
