If you’re running the JetPack plugin for WordPress, you can easily add audio you’ve uploaded with the shortcode:
[cc lang=”html”][/cc]
For those interested in slinging their own uploaded audio and video by using HTML5 via a shortcode, here’s how:
HTML5 Audio Shortcode
Simply place this snippet in your functions.php or into your own functionality plugin:
[cc lang=”php”]function html5_audio($atts, $content = null) {
extract(shortcode_atts(array(
“src” => ”,
“autoplay” => ”,
“preload”=> ‘true’,
“loop” => ”,
“controls”=> ”
), $atts));
return ‘‘;
}
add_shortcode(‘audio5’, ‘html5_audio’);[/cc]
And the shortcode:
[cc lang=”html”][audio5 src=”http://your-site/videos/your-video.mp4″ loop=”true” autoplay=”autoplay” preload=”auto” loop=”loop” controls=””][/cc]
I would like to find a shortcode that is a little more … well … short?
HTML5 Video Shortcode
What fun is it to use HTML5 for just audio and not video, right?
Again, you place this junk in your functions.php or into a fancy functionality plugin:
[cc lang=”php”]function html5_video($atts, $content = null) {
extract(shortcode_atts(array(
“src” => ”,
“width” => ”,
“height” => ”
), $atts));
return ‘
And here’s the semi-shortcode:
[cc lang=”html”][video5 src=”http://your-site/videos/your-video.mp4″ width=”720″ height=”480″][/cc]
And that’s it!
Give it a try and tell me what you think!
James says
Thanks for that, really useful!
Naina Bright says
I’ve always wanted to have a podcast on my blog but I wasn’t quite sure what plugin would work. This would make a great tool for bloggers!