I hope you guys can help me with this little bug I’ve encountered. I am using a shortcode to display an audio player in the entries.
This is the code i’ve put in my functions.php:
function html5_audio($atts, $content = null) {
extract(shortcode_atts(array(
"src" => '',
"preload"=> 'none',
"loop" => ''
), $atts));
return '<audio src="'.$src.'" preload="'.$preload.'" loop="'.$loop.'" />';
}
add_shortcode('audio', 'html5_audio');
And this is the shortcode:
The shortcode itself is working and displaying the audio player. But any other content that is posted after the shortcode within that post won’t appear on the blog. I tried embedding the audio file directly with <audio>
and it worked. So HTML5 is working alright. Only the shortcode seems to be causing trouble.
Any help is appreciated! Thanks in advance.
You forgot the closing
</audio>
tag at the end.