Timeline for Enqueue jQuery in WordPress
Current License: CC BY-SA 3.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 29, 2012 at 15:55 | comment | added | W van Dam | When you load a script as Stephen Harris suggests, the scripts will be put in the footer. Keep this in mind when your script should be loaded before others. Also, if you actually want to force a script to be loaded into the footer, you can set the 5th argument of 'wp_enqueue_scripts' or 'wp_register_script' to true (Codex: codex.wordpress.org/Function_Reference/wp_enqueue_script). | |
Jul 29, 2012 at 15:21 | vote | accept | Ant | ||
Jul 29, 2012 at 15:22 | |||||
Jul 29, 2012 at 14:19 | comment | added | Ant | Useful to know guess this all comes down to optimisation of the web page, thanks Stephen. | |
Jul 29, 2012 at 13:57 | comment | added | Stephen Harris |
+1 Note since 3.3 you can use wp_enqueue_script inside shortcode/widget callbacks (or otherwise in the body of the page). This means you can register a script on the hook wp_enqueue_scripts and then only actually load it when it's needed.
|
|
Jul 29, 2012 at 13:24 | comment | added | Ant | Amit, thank you for this and missed this before, very much appreciated. | |
Jul 29, 2012 at 12:56 | history | answered | Amit Kosti | CC BY-SA 3.0 |