Latest Video Embed
Latest Video Embed
// Add Shortcode function latest_video_embed_shortcode( $atts ) { // Attributes extract( shortcode_atts( array( 'username' => '', 'width' => '', 'height' => '', ), $atts ) ); // Code $url = 'http://gdata.youtube.com/feeds/api/users/'.$username.'/uploads'; $data = file_get_contents($url); $filter = "/<media:content url='(.+?)'/"; preg_match($filter,$data,$results); $videoURL = $results[1]; return '<object width="'.$width.'" height="'.$height.'"><param name="movie" value="'.$videoURL.'"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="'.$videoURL.'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="'.$width.'" height="'.$height.'"></embed></object>'; } add_shortcode( 'latest_video_embed', 'latest_video_embed_shortcode' );