Skip to content

Instantly share code, notes, and snippets.

@bueltge
Created August 2, 2011 06:51
Show Gist options
  • Save bueltge/1119715 to your computer and use it in GitHub Desktop.
Save bueltge/1119715 to your computer and use it in GitHub Desktop.
Shortcode for HTML5 Video Tag in WordPress
function html5_video( $atts, $content = NULL ) {
extract( shortcode_atts( array(
"src" => '',
"width" => '',
"height" => ''
), $atts ) );
return '<video src="' . $src . '" width="' . $width . '" height="' . $height . '" controls autobuffer>';
}
add_shortcode( 'video5', 'html5_video' );
Now you can use the following shortcode in your post:
[video5 src="http://example.com/videos/your-video.mp4" width="720" height="480"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment