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