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

<?php $showContent = get_theme_mod('premium_slider_show_content', 'on'); ?>
<div id="ht-home-slider-section">

	<div class="slider-shape"></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(); 
			
	 $slider1btntext = get_post_meta($post->ID, 'slider1btntext', false);
			        $test_slider1btntext = !empty($slider1btntext[0]) ? $slider1btntext[0] : '';

			   $slider2btntext = get_post_meta($post->ID, 'slider2btntext', false);
			        $test_slider2btntext = !empty($slider2btntext[0]) ? $slider2btntext[0] : '';


				?>
				<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 " data-wow-duration="1s">	
							<div class="ht-slide-cap-title ">

								<?php echo (get_the_title()); ?>
							</div>
							<div class="ht-slide-cap-desc">
								<?php echo (get_the_content()); ?>
							</div>	
							<div class="slider-btn ">
								<ul>
								 <?php
                                $sliderbtn1url = get_post_meta($post->ID, 'sliderbtn1url', false);
                                $slider1_btn_url = !empty($sliderbtn1url[0]) ? $sliderbtn1url[0] : '';

                                ?>

								<?php if ($slider1_btn_url) { ?>		
								<li>
									<div class="sliderbtn">	
										<div class="ht-slide-cap-descmore">	
											<a class="secondry-bg" href="<?php echo $slider1_btn_url; ?>"><?php echo ($test_slider1btntext); ?></a>
										</div>
									</div>
								</li>
								<?php } ?>
								<?php
                                $designation = get_post_meta($post->ID, 'designation', false);
                                $slider2_btn_url = !empty($designation[0]) ? $designation[0] : '';

                                ?>
								<?php if ($slider2_btn_url) { ?>		
								<li>
									<div class="sliderbtn2">	
										<div class="ht-slide-cap-descmore2">	
											<a class="secondry-bg" href="<?php echo $slider2_btn_url; ?>"><?php echo ($test_slider2btntext); ?></a>
										</div>
									</div>
								</li>
								<?php } ?>
								</ul>
							</div>
						</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 ">
					<div class="ht-slide-cap-title">We Provide The Best <b>Nursery And Garden Care Services!</b> </div>
					<div class="ht-slide-cap-desc">Exercitation llamco laboris nis aliquip sed conseqrure dolorn repreh velit excepteur duis aute.Exercitation llamco laboris nis</div>
					<div class="slider-btn ">	
					<ul>
						<li>
							<div class="sliderbtn">	
								<div class="ht-slide-cap-descmore">	
									<a class="secondry-bg" href="#"><?php _e( 'Get Started', 'luzuk-premium' ); ?></a>
								</div>
							</div>
						</li>	
						<li>
							<div class="sliderbtn2">	
								<div class="ht-slide-cap-descmore2">	
									<a class="secondry-bg" href="#"><?php _e( 'Know More', 'luzuk-premium' ); ?></a>
								</div>
							</div>
						</li>	
					</ul>
				</div>
				</div>
					<?php }?>
				</div>
				<?php }
			}?>
		</div>
		
	</div>
