Skip to content

Instantly share code, notes, and snippets.

@flymke
Last active November 19, 2021 08:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flymke/8259d9fb31f81bf0939f5cf30e88ba2a to your computer and use it in GitHub Desktop.
Save flymke/8259d9fb31f81bf0939f5cf30e88ba2a to your computer and use it in GitHub Desktop.
SantaPress - play audio file when opening a door
add_action( 'wp_head', function () { ?>
<script>
/* Audio file attribution
Merry Christmas sound effects from Air Media
www.airmedia.co
https://freesound.org/s/349855/
This work is licensed under the Creative Commons 0 License.
*/
/* play audio file on a single door click */
jQuery(document).ready(function($){
$( document ).on( "click", '.santapress-door.status-publish[data-postid="178"]', function(event) {
var audio = new Audio('https://santapress.halloecho.de/christmas.mp3');
audio.play();
});
});
/* play audio file on all doors */
jQuery(document).ready(function($){
$( document ).on( "click", ".santapress-door.status-publish", function(event) {
var audio = new Audio('https://santapress.halloecho.de/christmas.mp3');
audio.play();
});
});
</script>
<?php } );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment