I am trying to create a theme using curtains.js but am having a few problems. I have both registered and enqueued the script and the part that would go in the footer like so:
add_action('wp_enqueue_scripts', 'tf_load_custom_scripts');
function tf_load_custom_scripts() {
wp_register_script('curtain', get_template_directory_uri().'/js/curtain.js', array('jquery'), 2.0 );
wp_register_script('curtain-instance', get_template_directory_uri().'/js/curtain-instance.js', array('curtain','jquery'), true );
if( is_front_page() ) {
wp_enqueue_script('curtain');
wp_enqueue_script('curtain-instance');
}
wp_enqueue_script('custom_script', get_template_directory_uri().'/js/script.js', array('jquery'), 1.0, true );
}
I've also changed all the $
to jQuery
to comply with no-conflict rules.
My scripts all seem to be loading fine but not running. I'm probably missing something very obvious. Thanks in advance for any insight.
wp_enqueue_script('curtain');
is not needed once you registered 'curtain' as a dependence for 'curtain-instance' that is enqueued the next line) But sure problem is not this. Again, this code is good (and if all the files you enqueue are where you search for them) what causes the problem 99,99% is somewhere else. If your js code is wp-related post here, if not try asking stackoverflow. – G. M. Sep 3 at 14:23