[wp-hackers] Accessing jQuery in Core for a plugin

ade ade at studiograsshopper.ch
Tue Nov 11 12:55:13 GMT 2008


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.  

 

> Jason Webster wrote on 
> Tue Nov 11 05:50:06 GMT 2008 
>
> It is worthwhile to note that only WP
> 2.6 includes jQuery 1.2.6+. For
> example, 2.5 shipped with 1.2.3, so if backwards compatibility is a
> priority of yours, make sure not to utilize any > 1.2.3 specific
> features. The only big change to note was that the dimensions plugin
> (which was included with WP < 2.6, so you'd have to enqueue it > separately) was integrated with the jQuery core. 




More information about the wp-hackers mailing list