[wp-hackers] Accessing jQuery in Core for a plugin
ade
ade at studiograsshopper.ch
Tue Nov 11 22:54:01 GMT 2008
Thanks Viper007Bond! :-)
> Viper007Bond wrote:
>
> http://codex.wordpress.org/Function_Reference/wp_enqueue_script
>
> 1. Once per new script.
>
> 2. WordPress will handle outputting. Don't do anything with the head, > etc.
>
> 3. Call the wp_enqueue_script() at the very, very top of the page template.
>
> On Tue, Nov 11, 2008 at 4:55 AM, ade <ade at studiograsshopper.ch> wrote:
>
> Jason,
>
> Thank for the tip!
>
> To all,
>
> Some more questions, if I may:
>
> 1. If I want to load two js files that need jQuery, do I simply call
> wp_enqueue_script twice?
>
> 2. In terms of action hooks, should I be using wp_print_scripts? It seems
> to me that using 'init' or 'template_redirect' loads the scripts before the
> HEAD html tag. (testing on 2.7 beta2) and (as I've read elsewhere) wp_head
> is too late.
>
> 3. The javascript files generate a gallery in a page template. What is the
> cleanest way of only loading these scripts on pages that contain the gallery
> - ie avoid loading the scripts on every page? The gallery will be triggered
> by a do_action call in the template page.
>
> Again, thanks in advance.
>
> Ade.
More information about the wp-hackers
mailing list