<?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(); 
			

			if( get_theme_mod('slider_areaOpacity',true) ) {
				$slider_areaOpacity = 'opacity:'.esc_attr(get_theme_mod('slider_areaOpacity')).';';
			}

			 $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="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">
						<div class="title wow fadeInUp">
							<?php echo (get_the_title()); ?>
						</div>
						<div class="sub-title wow fadeInLeft">
							<?php echo (get_the_content()); ?>
						</div>		
						 
						<div class="slider-btn wow fadeInDown">	
						<ul>
							 <?php
                            $sliderbtn1url = get_post_meta($post->ID, 'sliderbtn1url', false);
                            $slider1_btn_url = !empty($sliderbtn1url[0]) ? $sliderbtn1url[0] : '';

                            ?>
                            <?php if ($slider1_btn_url) { ?>
							<li><a class="btn btn-lg f-btn" href="<?php echo $slider1_btn_url; ?>"><?php echo ($test_slider1btntext); ?><i class="fa fa-play-circle"></i></a></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><a class="btn btn-lg s-btn" href="<?php echo $slider2_btn_url; ?>"><?php echo ($test_slider2btntext); ?></a></li>
								<?php }?>
							</ul>
						</div>
					</div>
					<?php }?>
				</div>
				<?php
			endwhile;
		}else{ 
			for($i=0;$i<6;$i++){?>
			<div class="ht-slide">	
			<div class="slider_gradiant"></div>
				<?php echo '<img class="slide-mainimg" alt="Slider" src="'. esc_html(get_template_directory_uri()) .'/images/slider-car.jpg">';?>
				<?php if($showContent == 'on'){?>
					<div class="slider_content wow zoomIn">
						<div class="title wow fadeInUp" data-wow-duration="1s">THUNDER STROM<br><span>-HUNTER OF THE NIGHT-</span></div>
						<div class="sub-title wow fadeInLeft" data-wow-duration="2s">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris.</div>	
						<div class="slider-btn wow fadeInDown">	
							<ul>
								<li><a class="btn btn-lg f-btn" href="#"><?php _e( 'Watch Now', 'luzuk-premium' ); ?><i class="fa fa-play-circle"></i></a></li>
								<li><a class="btn btn-lg s-btn" href="#"><?php _e( 'Add to Wachlist', 'luzuk-premium' ); ?></a></li>
							</ul>
						</div>
					</div>
				<?php }?>
			</div>
			<?php }
		}?>
	</div>
</div>
