Audio Player for MP3 Files for WordPress
http://en.support.wordpress.com/audio/
http://en.support.wordpress.com/audio/
You forgot the closing </audio> tag at the end. function html5_audio($atts, $content = null) { extract(shortcode_atts(array( “src” => ”, “preload”=> ‘none’, “loop” => ” ), $atts)); return ‘<audio src=”‘.$src.'” preload=”‘.$preload.'” loop=”‘.$loop.'” /></audio>’; } add_shortcode(‘audio’, ‘html5_audio’);
There is MP3 to Post plugin in official repository. It does not integrate with uploader, but it shows how to use getID3 PHP library to retrieve that information from file.
WordPress 3.6. WordPress also features a video player as well, so no need for plugins anymore Audio / Video support in Core
Nothing wrong with the function above. Turns out my function was placed inside an a href tag.
Replace following line $result .= ‘echo do_shortcode()’; with $result .= do_shortcode(”); Echo the result of function <p><?php echo first_audio(); ?></p>
I found that this issue could be overcome by opening the mp3 file in the excellent Linux/Windows application Mp3 Diags and applying the Rebuild VBR Data transformation. It discards the file’s Xing header and attaches a new one. After doing this, the files’s duration and bitrate are listed in it’s Attachment Details when it is … Read more
I looked at the wp_audio_shortcode function in wp-includes/media.php of the release version of WordPress 3.6. The preload parameter is a valid attribute of the shortcode. However, the default is ‘none’, so in my case it is not needed. From WordPress 3.6 (release), wp-includes/media.php, function wp_audio_shortcode: $default_types = wp_get_audio_extensions(); $defaults_atts = array( ‘src’ => ”, ‘loop’ … Read more
Okay so i did manage to add some custom css selectively on pages that load the medialement player by adding this to my functions.php file: function custom_player() { wp_enqueue_style( ‘custom-player’, get_stylesheet_directory_uri() . ‘/wp-mediaelement.css’ ); $custom_css = ” /*here goes the css*/ “; wp_add_inline_style( ‘custom-player’, $custom_css ); } add_action( ‘wp_enqueue_scripts’, ‘custom_player’ ); Like this by using … Read more
Yeah, you can access that data using get_post_meta, remember that almost everything in WordPress is a type of a post, an audio its a wp_attachment type, you just need the ID, also you can make a shortcode, this is an example: function my_audio_func($atts) { $audio_id = $atts[‘id’]; //we need an ID as attribute //we get … Read more