    <?php
/**
 * Theme Name: EduCare
 * Theme URI: http://demo.com/educare
 * Author: demo.com
 * Author URI: http://demo.com
 * Description: Themes Is WordPress Theme Market
 * @package eschool
 */
 global $codedokan;
 ?> 
                                      
           <?php 
								$count_posts = wp_count_posts( 'video_gallery' )->publish;
								if ($count_posts == 0){
									get_template_part( 'template-parts/html/Video' );
								}else{
								?>                            
                            <!--==========================
                              Video section Start
                            ===========================--> 
    <div class="video-seciton">
        <div class="container">
            <div class="row">
                <div class="col-lg-12 col-md-12">
                    <div class="video-section-wrpp">
                        <div class="video-seciton-title">
							 <?php echo $codedokan['video_title']; ?>
                        </div>

                        <div class="video-seciton-img">
                            <img src="<?php echo get_template_directory_uri(); ?>/assets/images/icon-image.png" alt="">
                        </div>
                    </div>
                        
                </div>
            </div>
            
            <div class="row">
                <div class="col-md-12">
                    <div class="video-list owl-carousel">                        
                        
						<?php $cat_id = $codedokan['video_cat'];
					if($cat_id == 0) { ?>
					<?php
									$how_post = $codedokan['how_video'];
									$code_dokan = new WP_Query(array(
										'post_type' => 'video_gallery',
										'offset'     =>0,
										'posts_per_page' => $how_post,
									));
									while($code_dokan->have_posts()) : $code_dokan->the_post(); ?>
									<?php $youtube_id = get_post_meta(get_the_ID(),'youtube_link', true); ?>
									
									
						<div class="video-wrpp">
                            <div class="video-item">
                                <?php if(has_post_thumbnail()){ 
												the_post_thumbnail();}
												else{?>
                                    <img src="https://img.youtube.com/vi/<?php echo $youtube_id;?>/maxresdefault.jpg" />
												<?php } ?>
												
                                <a href="https://www.youtube.com/watch?v=<?php echo $youtube_id;?>" class="video-icon popup "><i class="la la-play"></i></a>
                            </div>
                            <div class="video-title">
                                <a href="https://www.youtube.com/watch?v=<?php echo $youtube_id;?>" class="popup"> <?php echo the_title();?> </a> 
                            </div>                             
                        </div>  



<?php endwhile;?>
					<?php }else{
					?>

                    <?php
								$term = get_term_by( 'id', $cat_id, 'videocat' );
                                $cat_name = $term->name;    
                                $cat_slug = $term->slug; 
								$how_post = $codedokan['how_video'];
								
							?>
							<?php   
									$args = array( 
										'post_type' => 'video_gallery',
										'posts_per_page' => $how_post,
										  'tax_query' => array(
											'relation' => 'OR',     
											array(
												'taxonomy' => 'videocat',
												'field'    => 'slug',
												'terms'    => $cat_slug,
											),
								
											) 
										); 
									$loop = new WP_Query( $args );
									while ( $loop->have_posts() ) : $loop->the_post(); ?>
									
									<?php $youtube_id = get_post_meta(get_the_ID(),'youtube_link', true); ?>

					<div class="video-wrpp">
                            <div class="video-item">
                                <?php if(has_post_thumbnail()){ 
												the_post_thumbnail();}
												else{?>
                                    <img src="https://img.youtube.com/vi/<?php echo $youtube_id;?>/maxresdefault.jpg" />
												<?php } ?>
												
                                <a href="https://www.youtube.com/watch?v=<?php echo $youtube_id;?>" class="video-icon popup "><i class="la la-play"></i></a>
                            </div>
                            <div class="video-title">
                                <a href="https://www.youtube.com/watch?v=<?php echo $youtube_id;?>" class="popup"> <?php echo the_title();?> </a> 
                            </div>                             
                        </div>   


  <?php endwhile; wp_reset_query(); ?> 
					<?php } ?>									
                                           
                                          
         
                    </div>
                </div>
            </div>
        </div>
    </div>   
	 <?php } ?>
                            <!--==========================
                                Video Section End
                            ===========================--> 
                                                                                         
                                  
                                      
                                      
                                 