Shortcode for HTML5 audio in posts and pages
wordpress snippet
Adding this snippet to the functions.php of your wordpress theme will create a new shortcode for HTML5 audio. Just add the second snippet of shortcode to a post or page to add HTML5 audio.
snippet : PHPcopy
function html5_audio($atts, $content = null) {
extract(shortcode_atts(array(
"src" => '',
"autoplay" => '',
"preload"=> 'true',
"loop" => '',
"controls"=> ''
), $atts));
return '<audio src="'.$src.'" autoplay="'.$autoplay.'" preload="'.$preload.'" loop="'.$loop.'" controls="'.$controls.'" autobuffer />';
}
add_shortcode('audio5', 'html5_audio');
snippet : SHORTCODEcopy
[audio5 src="http://your-site/videos/your-video.mp4" loop="true" autoplay="autoplay" preload="auto" loop="loop" controls=""]
this months featured snippets
- http://twitter.com/wpforchurch WordPress for Church
- http://wpsnipp.com Kevin Chard






