I got the following setup:
- Parent & Child Theme (Parent contains basic stuff, but no loops, style, etc.)
- inside the functions.php of the Parent Theme i call my init.file, that cares about different stuff
- right at the begging of the parent functions.php file (before the init happens) i call my constants.php file that defines theme version, etc.
When i now call
wp_enqueue_script($name, $path, $parent, VERSION_CONSTANT, $footer)
and set
$footer == true;
i would expect to get
a) the script loaded in my footer and
b) to get the *VERSION_CONSTANT* as my version number.
But it doesn't work.
Here is my workaround:
- Set
$footer == true; - pack it into a function
- add_action that function to a hook on top
...and stupid as it is: it works like a charm and the constant value get's inserted correct.
Can anyone confirm this or has some explanation? I would expect to find the cause for this particular problem at where wp_enqueue_script get's loaded. This would explain why it works with the function (loaded later).
Thanks!