<?php
/**
 *
 * @package Slider Premium
 */
?>
<?php $showContent = get_theme_mod('slider_section_show_content', 'on'); ?>
<div class="slider_section" id="slider">
    <div class="owl-slider">
        <div id="carousel" class="owl-carousel">
            <?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 = 'Read More';
                }

                $pgLink2 = '';
                $slider_btn2_link = get_post_meta($post->ID,'slider_btn2_link',false);
                $sliderBtn2Txt = get_post_meta($post->ID,'sliderBtn2Txt',false);
                if(!empty($slider_btn2_link) && is_array($slider_btn2_link)){
                    $pgLink2 = esc_url(get_permalink($slider_btn2_link[0]));
                }
                if(!empty($sliderBtn2Txt) && is_array($slider_btn2_link)){
                    $pgLkTxt2 = $sliderBtn2Txt[0];
                }else{
                    $pgLkTxt2 = 'Explore Our Service';
                }

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

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

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

            ?>
            <div class="item">       
                <div class="row">
                    <?php  if($showContent == 'on'){   ?>
                    <div class="slider_content " data-wow-duration="1s">          
                        <?php if( get_theme_mod('slcir_button_display','show' ) == 'show') :?> 
                            <div class="cir"> </div>
                        <?php endif ?>     
                        <?php 
                            if(!empty($sliderdatetext)){ ?>
                            <div class="sub-title animated "><?php echo $sliderdatetext; ?></div>
                         <?php }?>
                        <div class="title" data-wow-duration="1s"> <?php echo (get_the_title()); ?> </div>
                        <p>  <?php echo (get_the_content()); ?> </p>   
                        <div class="s-text">
                            <div class="row mr-0">
                                <div class="num inner-area-title"> <?php echo ($slide_num); ?> </div>
                                <div class="numtxt">
                                    <?php echo ($slide_nmtxt); ?> 
                                </div>
                            </div>
                        </div>     
                        <div class="slide-btna ">
                            <?php if(!empty($pageLinkTxt  )){ ?>
                            <div class="btn1">  
                                <a href="<?php echo $pageLink; ?>">
                                    <div class="txtinn">
                                        <?php echo($pageLinkTxt); ?> 
                                    </div>
                                </a>
                            </div>
                            <?php }?>
                            <?php if(!empty($pgLkTxt2 )){ ?>
                            <div class="btn2"> 
                                <a href="<?php echo $pgLink2; ?>">
                                    <div class="txtinn">
                                       <?php echo($pgLkTxt2); ?> 
                                   </div>
                                </a> 
                            </div>
                            <?php }?>
                        </div>        
                        <?php if( get_theme_mod('slcir_button_display','show' ) == 'show') :?> 
                        <div class="cir2"> </div>  
                        <?php endif ?>        
                    </div>
                    <?php }?>
                    <div class="imbx " data-wow-duration="1s">
                        <?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 class="overlay"></div>
                    </div>
                </div>
            </div>
            <?php
                endwhile;
            }else{ 
                for($i=0;$i<6;$i++){?>
            <div class="item">
                <div class="row">
                    <?php if($showContent == 'on'){?>     
                    <div class="slider_content" data-wow-duration="1s">
                        <?php if( get_theme_mod('slcir_button_display','show' ) == 'show') :?> 
                            <div class="cir"> </div>
                        <?php endif ?>                     
                        <div class="sub-title animated "> FOR BUSINESSES </div>
                        <div class="title " data-wow-duration="1s">We Don't Just Deliver Services, <span>We Drive Results That Matter </span></div>
                        <p>
                           Partner with a team that transforms your business challenges into measurable growth. From strategy to execution, we're your catalyst for success
                        </p>            
                        <div class="s-text">
                            <div class="row mr-0">
                                <div class="num inner-area-title">200+</div>
                                <div class="numtxt">
                                    Join 200+ businesses who've accelerated their growth with our proven methodology and expert team.
                                </div>
                            </div>
                        </div>
                        <div class="slide-btna ">
                            <div class="btn1">
                                <a href="#">
                                    <div class="txtinn">
                                       <?php _e( 'Start Your Transformation' , 'luzuk-premium' ); ?> 
                                    </div>
                                </a>
                            </div>
                            <div class="btn2">
                                <a href="#">
                                    <div class="txtinn">
                                       <?php _e( 'See Our Work ' , 'luzuk-premium' ); ?>
                                    </div>
                                </a>
                            </div>
                        </div>
                        <?php if( get_theme_mod('slcir_button_display','show' ) == 'show') :?> 
                            <div class="cir2"> </div>  
                        <?php endif ?>
                    </div>
                    <?php }?>  
                    <div class="imbx " data-wow-duration="1s">
                        <?php echo '<img class="slide-mainimg" alt="Slider" src="'. esc_html(get_template_directory_uri()) .'/images/slider.jpg">';?>
                        <div class="overlay"></div> 
                    </div>  
                </div>
            </div>
                <?php }
            }?>
        </div>
    </div>
    <?php if( get_theme_mod('scrl_button_display','show' ) == 'show') :?> 
    <div class="s-btn">
        <?php
            $scrl_idtitle = get_theme_mod('scrl_idtitle', 'about');
        ?>
        <div class="scol-btn">
            <div id="#<?php echo ($scrl_idtitle); ?>"><span></span>Scroll Down  <i class="fa fa-angle-down" ></i></div> 
        </div>
    </div>
    <?php endif ?>
</div>
<script>
    $(function() {
  $('.s-btn [id*=#]').on('click', function(e) {
    e.preventDefault();
    $('html, body').animate({ scrollTop: $($(this).attr('id')).offset().top}, 500, 'linear');
  });
});
</script> 
<script>
        $(document).ready(function() {
          $('.slider_section .owl-carousel').owlCarousel({
            refreshClass: 'owl-refresh',
            autoplayTimeout:6000,
            loop: true,
            margin: 30,
            autoHeight: true,
            autoWidth: false,
            autoplay: true,
            // animateOut: 'lightSpeedOut',
            //animateIn: 'zoomIn',
            navText: [
                    '<i class="fa fa-caret-left"></i> ',
                    '<i class="fa fa-caret-right" ></i>'
                ],
            responsiveClass: true,

            responsive: {
              0: {
                items: 1,
                nav: true,
                margin: 40
              },
              600: {
                items:1,
                nav: true,
                margin: 50
              },
              1000: {
                items:1,
                nav: true,
                loop: true,
                margin: 100
              }
            }
          })
        })

</script>
