Last active
November 19, 2021 08:20
-
-
Save flymke/8259d9fb31f81bf0939f5cf30e88ba2a to your computer and use it in GitHub Desktop.
SantaPress - play audio file when opening a door
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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