Javascript loading with dependency
-
Hi,
I’m trying to get this code working (http://http://jsfiddle.net/qlmhuge/t7a1sh4u/)on my wordpress site (http://dev-markandersonpianist.pantheonsite.io/discography/).I have created a function in my functions.php file to load the scripts.
function my_scripts_method() { $template_dir = get_stylesheet_directory_uri(); wp_enqueue_script('results', $template_dir . '/js/results.js', array('jquery'), null, true); wp_enqueue_script('discography', $template_dir . '/js/discography.js', array('jquery', 'results'), null, true); } add_action( 'wp_enqueue_scripts', 'my_scripts_method');Have I created the correct wp_enqueue_script to load the dependency that the first script has on the second script. See (
http://http://jsfiddle.net/qlmhuge/t7a1sh4u/) scripts.I have included the scripts on the discography page as well.
The scripts don’t appear to be loading. Any help would be much appreciated.
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
The topic ‘Javascript loading with dependency’ is closed to new replies.