Shortcode for HTML5 Video Tag in WordPress

HTML5 has made it a lot easier to include certain elements. Especially videos, since you no longer have to embed them with all those parameters. Here’s a short code snippet that will add an HTML5 video shortcode to WordPress. Just include this code in your functions.php file and you are ready to go:
function html5_video($atts, $content = null) {
	extract(shortcode_atts(array(
		"src" => '',
		"width" => '',
		"height" => ''
	), $atts));
	return '
Now you can use the following shortcode in your post:
[video5 src="http://your-site/videos/your-video.mp4" width="720" height="480"]
You can read more on which browsers support which formats at http://en.wikipedia.org/wiki/HTML5_video.
Search

Popular Posts

Small Biz Website Tips Newsletter

Stay up to date with the latest marketing, sales, and service tips and news.

Small Biz Website Tips Newsletter

Stay up to date with the latest marketing, sales, and service tips and news.