'overlay', 'feature' => '', 'width' => '600', 'height' => '360', ), $atts)); // start output buffer collection ob_start(); // depending on shortcode parameters, do different things if ( $feature == 'embed' ) { $params = array( 'posts_per_page' => 1, 'post_type' => 'external-videos', 'post_status' => 'publish', ); query_posts($params); if ( have_posts() ) { // extract the video for the feature the_post(); $videourl = get_post_meta(get_the_ID(), 'video_url'); $video = trim($videourl[0]); // get oEmbed code $oembed = new WP_Embed(); $html = $oembed->shortcode(null, $video); // replace width with 600, height with 360 $html = preg_replace ('/width="\d+"/', 'width="'.$width.'"', $html); $html = preg_replace ('/height="\d+"/', 'height="'.$height.'"', $html); // just print the embed code for the newest video echo $html; } } else { // extract the videos for the gallery $params = array( 'posts_per_page' => 20, 'post_type' => 'external-videos', 'post_status' => 'publish', ); $old_params = $wp_query->query; $params['paged'] = $old_params['paged']; query_posts($params); // display the gallery display_gallery($width, $height, $link); } //Reset Query wp_reset_query(); $result = ob_get_clean(); return $result; } function display_gallery ($width, $height, $link) { global $wp_query, $post, $features_3_0; ?> max_num_pages > 1 ) : ?>
shortcode(null, $video); // replace width with 600, height with 360 $html = preg_replace ('/width="\d+"/', 'width="'.$width.'"', $html); $html = preg_replace ('/height="\d+"/', 'height="'.$height.'"', $html); ?>
max_num_pages > 1 ) : ?>