<?php  
/**
 *
 * @package Luzuk
 */
?>
<?php $showContent = get_theme_mod('luzuk_them_premium_slider_show_content', 'on'); ?>
<div id="ht-home-slider-section">
	<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 = 'VIEW PROJECTS';
				}
				?>
				<div class="ht-slide">
					<?php 
							if( get_theme_mod('pages_slideopacity',true) ) {
				                $pages_slideopacity = 'opacity:'.esc_attr(get_theme_mod('pages_slideopacity')).';';
				            }
				            
	 					?>
					<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-cap-desc animated fadeInDownBig">
								<?php echo (get_the_content()); ?>
							</div>	
							<div class="ht-slide-cap-title animated fadeInLeftBig">
								<?php echo (get_the_title()); ?>
							</div>
							
							<?php 
							if(!empty($pageLink)){ ?>
							<div class="ht-slide-cap-descmore animated rotateInUpLeft">
								<a class="slider-button" href="<?php echo $pageLink; ?>"><?php echo ($pageLinkTxt); ?> <i class="fa fa-caret-right" aria-hidden="true"></i>
								</a>
							</div>
							<?php }?>				
						</div>
						<?php }?>
					</div>
					<?php
				endwhile;
			}else{ 
				for($i=0;$i<2;$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.jpg">';?>					
					<?php if($showContent == 'on'){?>
					<div class="ht-slide-caption">
					
					<div class="ht-slide-cap-desc animated fadeInDownBig">WELCOME TO CITY HOTEL</div>
					<div class="ht-slide-cap-title animated fadeInLeftBig">Enjoy The Experience</div>
						<div class="ht-slide-cap-descmore animated rotateInUpLeft text-center">	
							<a class="slider-button" href="<?php echo $pageLink; ?>"><?php _e( 'LEARN MORE', 'lz-fintess-premium' ); ?> <i class="fa fa-caret-right" aria-hidden="true"></i></a>

						</div> 
					</div>
					<?php }?>  
				</div>
				<?php }
			}?>
		</div>
		<?php if( get_theme_mod('bouncingicon_button_display','show' ) == 'show') :
								?>	
		<section class="company-heading intro-type" id="parallax-one">
   <div class="container">
      <div class="row product-title-info">
         <div class="col-md-12 ">
         	<?php
         	$headerbouncingbuttonlink = get_theme_mod('luzuk_them_header_bouncingbuttonlink', 'add link here');

         	?>
         	<?php if(!empty($headerbouncingbuttonlink)){ ?>
            <a class="ct-btn-scroll ct-js-btn-scroll bounce" href="<?php echo $headerbouncingbuttonlink ?>">  <i class="fa fa-angle-double-down"></i> </a>
            <?php }?>
         </div>   
      </div>
   </div>
</section>  
<?php endif ?>
	</div>
	<script>
	$(document).ready(function(){
  $("a").on('click', function(event) {
    if (this.hash !== "") {
      event.preventDefault();
      var hash = this.hash;
      $('html, body').animate({
        scrollTop: $(hash).offset().top
      }, 800, function(){
        window.location.hash = hash;
      });
    } 
  });
});
</script>
