<?php get_header(); ?>
<div id="full-content" class="">
    <section style="background: url('<?php echo home_url(); ?>/wp-content/uploads/2018/11/media-coverage-banner-bg.jpg')no-repeat center/cover;"  class="media-banner-bg">  
        <div class="container">
            <div class="page-title-cus">Video</div>
        </div>
    </section>
    <div class="container posRelative">
           
        <div class="row blog-details">
            <div class="col-md-8 col-12">
                <div class="single-blog-content"> 
                        <div class="page-title-custom">
                                    <h1 class="page-title-cus"><?php the_title(); ?></h1>
                        </div>
                        <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
                   
                            <div class="embed-responsive embed-responsive-16by9">
                                <iframe  src="<?php echo the_field('youtube_url') ?>" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"  allowfullscreen class="embed-responsive-item"></iframe>                
                            </div>
                            <?php  the_field('video_transcripts'); ?>
                        
                        <?php endwhile; ?> 
                        <?php endif; ?>
                        
                    </div>

                   
                

          </div>    
         <div class="col-md-4 col-12 sidebar-wrapper">
         <!--recent videos-->
            <div class="sidebar-box posts-box">
                    <h5>Recent Videos</h5>
                   <div class="sidbar-posts">
                       <?php
								$the_query = new WP_Query( array(
								'post_type'=>'video',
                                'posts_per_page'=>5,
								'order'=> 'ASC',
								'paged' => get_query_var('paged') ? get_query_var('paged') : 1) 
								); 
								 while ($the_query -> have_posts()) : $the_query -> the_post(); 
                            ?>
                            
                            <?php if (!empty(get_field('youtube_url'))) {?>
                                <div class="row post-item no-gutters">
                                <div class="col-5">
                                    <figure class="video-thumb post-img">
										<a href="<?php echo get_permalink(); ?>">
                                             <?php if (get_field('video_thumbnail') ) {
                                                     $image = get_field('video_thumbnail'); 
                                                 ?>
                                                 <img src="<?php echo $image['url'] ?>" alt="<?php the_title(); ?>" />                                               
                                            <?php } else { ?>
                                                <img src="<?php echo get_template_directory_uri() ?>/images/featured_default_image.jpg" alt="<?php the_title(); ?>" />
                                            <?php } ?>
                                         <i class="fa fa-play"></i>
                                        </a>
                                    </figure>
                                </div>
                                <div class="col-7">
                                    <div class="post-info">
                                         <p><span class="publish-date"><?php echo the_time('d M, Y'); ?></span></p>
                                        <h3><a href="<?php echo get_permalink(); ?>">  <?php echo wp_trim_words( get_the_title(), 8 ); ?></a></h3> 
                                    </div>
                                </div>
                        </div> 

                                <?php } else {?>   
                                    <div class="row post-item no-gutters">
                                <div class="col-5">
                                    <figure class="video-thumb post-img">
										<a href="<?php echo get_field( 'website_link'); ?>" target="_blank">
                                             <?php if (get_field('video_thumbnail') ) {
                                                     $image = get_field('video_thumbnail'); 
                                                 ?>
                                                 <img src="<?php echo $image['url'] ?>" alt="<?php the_title(); ?>"  />                                               
                                            <?php } else { ?>
                                                <img src="<?php echo get_template_directory_uri() ?>/images/featured_default_image.jpg" alt="<?php the_title(); ?>"  class="post-img" />
                                            <?php } ?>
                                         <i class="fa fa-play"></i>
                                        </a>
                                    </figure>
                                </div>
                                <div class="col-7">
                                    <div class="post-info">
                                         <p><span class="publish-date"><?php echo the_time('d M, Y'); ?></span></p>
                                        <h3><a href="<?php echo get_field( 'website_link'); ?>" target="_blank">  <?php echo wp_trim_words( get_the_title(), 8 ); ?></a></h3> 
                                    </div>
                                </div>
                        </div> 
                                    <?php } ?>
                         
                        <?php endwhile; ?>	                          
                    </div>
                </div>
                <!--recent videos-->
                <!--contact form-->
                 <!-- <div class="sidebar-box posts-box">
                    <h5>Get in Touch</h5>
                    <div class="sidebar-form">
                    <?php //echo do_shortcode( '[contact-form-7 id="1835" title="Get in Touch"]' ); ?>
                    </div>
                </div>-->
                <!--contact form-->
         
         </div>
    </div>
</div>
	<!-- Pop Message HTMl-->
	 <?php include(TEMPLATEPATH.'/includes/forms/enquiry.php'); ?>
	  <!-- Pop Message End -->
<?php get_footer(); ?>