wordpress shortcode video code example

Example 1: how to display video element in wordpress shortcode

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');

Example 2: how to display video element in wordpress shortcode

[video5 src="http://your-site/videos/your-video.mp4" width="720" height="480"]

Tags:

Misc Example