<?php
/**
 *
 * @package Slider Premium
 */
?>
<?php $showContent = get_theme_mod('slider_section_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 = 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="bor-tow">  
						<img src="<//?php echo esc_html(get_template_directory_uri()); ?>/images/shape-line.png" />

					</div> -->
					<div class="slider_gradiant"></div> 
							<?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]).'">';
						}?>

					<?php
					if($showContent == 'on'){
						?>
						<div class="slider_content wow zoomIn" data-wow-duration="1s">
							<div class="title">
								<?php echo (get_the_title()); ?>
							</div>
							<div class="sub-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); ?></a>
									</div>
								</div>
							<?php }?> 
						</div>
						<?php }?>
						<!-- <div class="shpeborder"></div> -->
						<div class="shape-middle" data-negative="true"></div>
						<div class="shape shape-bottom" data-negative="true">
							<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100" preserveAspectRatio="none">
			                        <path class="shape-fill" d="M500,97C126.7,96.3,0.8,19.8,0,0v100l1000,0V1C1000,19.4,873.3,97.8,500,97z"></path>
			                </svg>

			            </div>
					</div>
					<?php
				endwhile;
			}else{ 
				for($i=0;$i<6;$i++){?>
					<div class="ht-slide">
						<!-- <div class="bor-tow">  
						<img src="<//?php echo esc_html(get_template_directory_uri()); ?>/images/shape-line.png" />

					</div> -->
					<div class="slider_gradiant"></div>
						<?php echo '<img class="slide-mainimg" alt="Slider" src="'. esc_html(get_template_directory_uri()) .'/images/slider1.jpg">';?>
						
						<?php if($showContent == 'on'){?>
						<div class="slider_content wow zoomIn" data-wow-duration="1s">
							<div class="title" >SURFING</div>
							<div class="sub-title wow bounceInLeft">"Surfing is Life"</div>

							<div class="sliderbtn">	
								<div class="ht-slide-cap-descmore">	
									<a class="secondry-bg" href="<?php echo $pageLink; ?>"><?php _e( 'READ MORE', 'luzuk' ); ?></a>
								</div>
							</div>
								 
						</div>
						<?php }?>
						<!-- <div class="shpeborder"></div> -->
						<div class="shape shape-bottom" data-negative="true">
							<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100" preserveAspectRatio="none">
			                        <path class="shape-fill" d="M500,97C126.7,96.3,0.8,19.8,0,0v100l1000,0V1C1000,19.4,873.3,97.8,500,97z"></path>
			                </svg>

			            </div>
						
					</div>
				<?php }
			}?>

	</div>

</div>
