Reply To: Dismiss template notices after a few seconds
You could create a .js file in your child theme which you could use for all of your custom JavaScript. You’d then enqueue it with the following code (which goes into your child theme’s functions.php):
function my_enqueue_scripts() {
wp_enqueue_script( 'my-custom-js', get_stylesheet_directory() . '/js/script.js', array(), '1.0.0', true );
}
add_action( 'wp_enqueue_scripts', 'my_enqueue_scripts' );
Note:
This snippet will enqueue a script called script.js located at child-theme/js/script.js
Alternatively, you could just add the code to your footer.php file, just above the </body> tag like this:
<script>
// JavaScript goes here.
</script>