I have a childtheme Wordpress using a .php function that contains the following:
<?php add_action( 'wp_enqueue_scripts', 'load_custom_script' ); function load_custom_script() { wp_register_script( 'custom-script', get_template_directory_uri() . '/js/wpw-custom.js', array('jquery'), '1.0', true ); wp_enqueue_script( 'custom-script' ); } ?>
This successfully loads my custom script, in the footer, AFTER jQuery loads. The user script contains the following test code to tell me if the queue process is running:
$( document ).ready(function() { alert( "ready!" ); });
I can view the source on my pages and check that my wpw-custom.js has loaded successfully, but it does not fulfill the warning!
What have I done wrong and what steps can I take to methodically find out what I did wrong? Thanks so much for any help!
source share