JavaScript Files Registered in Parent Theme Won’t Load When Calling wp_enqueue_script() in Child Theme?

I’m making a framework parent theme and in the parent functions.php, I want to register all the possible js files I use frequently and if I want it to load it, in the child functions.php I just have to use wp_enqueue_script().

But it doesn’t work…

Read More

Any clue why?

Related posts

Leave a Reply

2 comments

  1. The child functions.php file loads before the parent functions.php, so you’re registering them after enqueueing them. Try enqueueing the scripts on a hook, like 'after_setup_theme' instead.

  2. It’s bad form to split your code like that. You should always have your functions and the hooks that call them located in the same location to make it easier to debug.

    That said, if you place your wp_enqueue_script() calls in the parent theme’s functions.php file, do things work like they’re supposed to? If not, there might be something else going on … and we’d need to see your code to diagnose and fix it.