How to get the number of times an audio file has been played

Yes, the play event fires on the <audio> element, so you could target it eg $(‘audio.wp-audio-shortcode’).on(‘play’, function (event) { //etc });. A number of other events are also available, eg ended, playing, pause. Here’s some code I’m trialing at the moment that may help you (in “functions.php”): add_action( ‘wp_footer’, function () { ?> <script> jQuery(document).ready(function() … Read more

Is ‘preload=”none”‘ a valid parameter in the [audio] shortcode in WordPress 3.6?

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

Using track metadata from audio shortcode

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

Adding a download link to native WordPress playlist

Thanks to both of you for your help. Just so it might help others, this is what I did: Downloaded a wordpress plugin to allow custom scripts. I used this one >> https://wordpress.org/plugins/header-and-footer-scripts-inserter/ I then pasted this code within the plugin (thanks to Birgire above & HERE : <script type=”text/html” id=”tmpl-wp-playlist-current-item”> <# if ( data.image … Read more

Removing Theme Audio Player – Using Browser Default

how to disable the WP theme player so that the browser default is always used? I get an audio player that does not support right-click copy audio link. I assume that this is the WP player and it’s replacing the browser player. Yes, that’s indeed the default WordPress media player which uses the Media Element … Read more