0

I'm placing some JS code in functions.php in my child theme but it loads first than anything else. Thus, I'm trying to get it to load later than the rest cos it needs Jquery. I tried enqueuing WP's built-in jquery like below but I still get "$ not defined" error cos I think the enqueue function runs later.

How can I pull this off? Should I place the code in footer.php?

3

1 Answer 1

0

Could you set priority parameter like this?

function child_theme_scripts() {
   // wp_enqueue_script
}
add_action( 'wp_enqueue_scripts', 'child_theme_scripts', 11 );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.