function wpsp_get_post_video_html($video = '') { // Get video $video = $video ? $video : wpsp_get_post_video(); // Return if video is empty if (empty($video)) { return; } // Check post format for standard post type if ('post' == get_post_type() && 'video' != get_post_format()) { return; } // Get oembed code and return if (!is_wp_error($oembed = wp_oembed_get($video)) && $oembed) { return '<div class="responsive-video-wrap">' . $oembed . '</div>'; } }
$args = array('post_type' => 'post', 'posts_per_page' => 1, 'tax_query' => array(array('taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array('post-format-video'), 'operator' => 'IN'))); $video_post_query = new WP_Query($args); if ($video_post_query->have_posts()) { while ($video_post_query->have_posts()) { $video_post_query->the_post(); ?> <section class="latest-video-wrap"> <div class="container"> <div <?php post_class(array('latest-video', 'wpsp-row', 'clearfix')); ?> > <div class="col span_1_of_2"> <?php printf('<div class="post-thumbnail"><a class="popup-youtube" itemprop="url" href="%1$s" rel="bookmark" title="%2$s">%3$s</a></div>', wpsp_get_post_video(), wpsp_get_esc_title(), wpsp_post_thumbnail('blog-post')); ?> </div> <div class="col span_1_of_2"> <?php get_template_part('template-parts/blog/blog-entry-title'); ?> <?php get_template_part('template-parts/blog/blog-entry-meta'); ?> <?php get_template_part('template-parts/blog/blog-entry-excerpt'); ?> </div> </div> <!-- .latest-video --> </div> <!-- .container -->