
<?php
/**
 * @package Luzuk Premium
 */
if(get_theme_mod('featured_area_disable') != 'on' ){ 
	?>
	<?php 
	if( get_theme_mod('sec_featuredsectionTpadding',true) ) {
		$sec_featuredsectionTpadding = 'padding-top:'.esc_attr(get_theme_mod('sec_featuredsectionTpadding')).';';
	}
	if( get_theme_mod('sec_featuredsectionBpadding',true) ) {
		$sec_featuredsectionBpadding = 'padding-bottom:'.esc_attr(get_theme_mod('sec_featuredsectionBpadding')).';';
	}

	?>	
	<div class="featured-area wow zoomIn" id="featured" style="<?php echo esc_attr($sec_featuredsectionTpadding); ?>" "<?php echo esc_attr($sec_featuredsectionBpadding); ?>">
		<?php
			$featured_title = get_theme_mod('luzuk_featured_title', 'Featured Videos');			
			$featured_subtitle = get_theme_mod('featured_subtitle', 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has industrys. Lorem Ipsum has industrys.');
		?>
        <?php if( get_theme_mod('fea_animation_display','show' ) == 'show') : ?>
				<div class="fea-icn-1">
					<img  src="<?php echo esc_url(get_template_directory_uri().'/images/ge4.png');?>" alt="" />
				</div>
				<div class="fea-icn-2">
					<img  src="<?php echo esc_url(get_template_directory_uri().'/images/ge3.png');?>" alt="" />
				</div>
				<div class="fea-icn-3">
					<img  src="<?php echo esc_url(get_template_directory_uri().'/images/ge1.png');?>" alt="" />
				</div>
				<div class="fea-icn-4">
					<img  src="<?php echo esc_url(get_template_directory_uri().'/images/ge4.png');?>" alt="" />
				</div>
			<?php endif ?>
						<div class="row">
				<div class="col-md-8 col-sm-7 pd-0">
					
						<?php if($featured_title || $featured_subtitle) { ?>
								<div class="section-title">
									<div class="headbrer"></div>
									<h2 class="headtitle"><?php echo ($featured_title);  ?></h2>
									<p class="headtext"><?php echo ($featured_subtitle);  ?></p>
								</div>
						<?php }?>
					
				</div>
				<div class="col-md-4 col-sm-5">
					<?php
						$featr_link = get_theme_mod('featr_link', '');
						$featr_button = get_theme_mod('featr_button1', 'View more');
					?>
					<?php if( get_theme_mod('featr_button_display','show' ) == 'show') :
						?>
						<div class="feagtopbtn">
							<a class="main-btn btn-3" href="<?php echo $featr_link ?>"> <?php echo $featr_button ?> <i class="fa fa-arrow-circle-right"></i></a>
						</div>
					<?php endif ?>
				</div>
			</div>

            <div class="owl-carousel owl-theme">			
                <?php
                $categories = get_theme_mod('post_video_categories');
                $args = array(
                    'number' => 12,
                    'orderby' => 'name',
                    'order' => 'asc',
                    'hide_empty' => false,
                    'include' => $categories
                );
                $product_categories = get_terms('video-category', $args);
                $i = 0;
                    foreach ($product_categories as $cat) {
                        if(!empty($cat)){
                            ?>
                            <?php
                            $i = 0;
                            $args = array( 'post_type' => 'our-video', 'posts_per_page' => 0,  'orderby' =>'date','order' => 'DESC' );
                            if(!empty($cat->slug)){
                                $args['video-category']= $cat->slug;
                            }
                            $product = new stdClass();
                            $loop = new WP_Query( $args );
                            while ( $loop->have_posts() ) : $loop->the_post();
                                global $product; ?>	
                               <?php $luzuk_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'medium_large'); ?>   
	  		<?php 
	            // if ($isCustomizer === true) {
	            	if(!empty($team_featured) && is_array($team_featured)){
	                $team_featured = get_theme_mod('team_featured' . $i);
	                
	            } else {
	                $team_featured = '';
	                
	            }

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

	        ?>            
		    <div class="fbbbnew">
		        <div class="item featureditems">
		            <div class="feaboxes">
		                <div class="featuredboxes">                        
		                    <a class="video" href="#<?php the_ID(); ?>">
		                        <div class="feabox">
		                            <div class="feabox-video">
		                                 <?php
		                                     if (has_post_thumbnail()) {
		                                        $image_url = $luzuk_image[0];
		                                    } else {
		                                        $image_url = get_template_directory_uri() . '/images/movie1.jpg';
		                                    }
		                                    ?>
		                                <img alt="<?php the_title(); ?>" src="<?php echo esc_url($image_url); ?>" /> 
		                                <i class="fa fa-play-circle-o" aria-hidden="true"></i>
		                            </div>    
		                        </div>
		                        </a>
		                        <div class="feagcontain">
		                            <div class="col-md-10 col-sm-10 col-xs-10">
		                                <h5> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h5>
		                               <?php
	    									$taxonomyName = "video-category";
	    									$terms = wp_get_post_terms( get_the_id(), 'video-category' );
											 $term  = reset($terms);
											foreach ($terms as $term) {
												if( isset( $term->name ) ){
												$img_ll = get_term_link($term->name, $taxonomyName);
												if ( is_wp_error( $img_ll ) ) {
												continue;
												}

											echo '<a class="video-post-cat" href="' . $img_ll . '"> ' . $term->name . '</a>';
											}
										}
										?>	
		                            </div> 
		                            <div class="col-md-2 col-sm-2 col-xs-2 pd-0">
		                            	<a class="video" href="#<?php the_ID(); ?>">
		                                <div class="feaarowbtn">
		                                    <div class="feaarowbtninn" href="<?php echo esc_url(get_permalink()); ?>">
		                                        <i class="fa fa-chevron-right"></i></div>
		                                </div>
		                                  </a>
		                            </div>
		                        </div>
		                        <div class="clearfix"></div>
		                  
		                </div>
		                <div class="fea-popup-content">
		                    <div id="<?php the_ID(); ?>">
		                         <iframe width="850" height="500" src="<?php echo ($team_featured) ?>" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> 
		                    </div>
		                </div>            
		            </div>
		        </div>
			    <script>
			        var links = $('.feaboxes a.video');
			            links.colorbox({
			              inline: true,
			              rel: 'featured'
			            });

			            /* Colorbox resize function */
			            var resizeTimer;
			            function resizeColorBox()
			            {
			                if (resizeTimer) clearTimeout(resizeTimer);
			                resizeTimer = setTimeout(function() {
			                        if ($('#cboxOverlay').is(':visible')) {
			                                $.colorbox.load(true);
			                        }
			                }, 300)
			            }

			        // Resize Colorbox when resizing window or changing mobile device orientation
			        $(window).resize(resizeColorBox);
			        window.addEventListener("orientationchange", resizeColorBox, false);

			        $('.feaboxes a.video').colorbox({maxWidth:'95%', maxHeight:'95%'});
			    </script> 
			       <div class="clearfix"></div>    
			</div>  

                        <?php endwhile; 
                        wp_reset_query(); 
                        ?><!-- 
                        <div class="clearfix"></div>    
                    </div> -->
                    <?php
                }
            }
            ?>  
           
        </div>
     <div class="clearfix"></div>  
</div>
<script>
        $(document).ready(function() {
          $('#featured .owl-carousel').owlCarousel({
            loop: true,
            margin: 30,
            autoplay: false,
            responsiveClass: true,
            responsive: {
              0: {
                items: 1,
                nav: true
              },
              600: {
                items:2,
                nav: true
              },
              1000: {
                items:4,
                nav: true,
                loop: true,
                margin: 10
              }
            }
          })
        })
</script>
<?php }



