Scripts (enqueued with wp_enqueue_scripts) were loaded outside wp_footer()
-
Hello,
today I found out, that all scripts I want to insert with the wp_enqueue_scripts() function (manually or scripts that will be inserted by other plugins with the same function) were not loaded in the wp_footer() function. All of them were loaded at the very bottom of the site – just before the </body> tag.
That results to an error on my site, because I inserted something after the wp_footer function, which needs the scripts, that are normally inserted inside the wp_footer.
After a lot of searching and testing I found out, that your plugin causes this error. After deactivating NextGen Gallery all scripts were placed correctly inside the wp_footer…
For better understanding I might show you an example.
That’s what my footer.php looks like:
(every script which is inserted with the wp_enqueue_script() function (and the wp_enqueue_scripts hook) should be placed inside the wp_footer() function)//... <?php wp_footer(); ?> //some code <script type="text/javascript"> ... </script> //maybe some more code </body> </html>
That’s what it looked like (with activated NextGen Gallery):
//... <!-- here comes the code which is correctly placed, using the wp_footer hook --> //some code <script type="text/javascript"> ... </script> //maybe some more code <!-- the following scripts use the wp_enqueue_scripts hook and will normally be placed inside the wp_footer / that's caused by your plugin --> <script type='text/javascript' src='my-path/to.js'></script> <script type='text/javascript' src='my-path/to.js'></script> //... maybe some more scripts </body> </html>
BTW things that are inserted over the wp_footer hook will be placed correctly! The problem only appears when using the wp_enqueue_scripts hook…
Do you have any ideas? Maybe it’s a bug in your code you should fix…
fyi
Wordpress Version: 3.8.1
NextGen Version: 2.0.40
PHP Version: 5.4
MySQL Version: 5.1
- The topic ‘Scripts (enqueued with wp_enqueue_scripts) were loaded outside wp_footer()’ is closed to new replies.