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

Jason Webster jason at intraffic.net
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.

ade wrote:
> Otto,
>
> That's perfect. Thanks! :-)
>
> Ade.
>
> ----- Original Message ----- 
> From: "Otto" <otto at ottodestruct.com>
> To: <wp-hackers at lists.automattic.com>
> Sent: Monday, November 10, 2008 9:31 PM
> Subject: Re: [wp-hackers] Accessing jQuery in Core for a plugin
>
>
>   
>> wp_enqueue_script('jquery');
>>
>> It's just that simple. You need to do it before wp_head though.
>> Preferably on the init action hook.
>>
>> Alternatively, if your own JS depends on jquery, then you can enqueue
>> your own script with a dependancy on jquery:
>> wp_enqueue_script('newscript', plugins_url('yourplugin/newscript.js',
>> array('jquery'), '1.0' );
>>
>> See: http://codex.wordpress.org/Function_Reference/wp_enqueue_script
>>
>>     
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>   



More information about the wp-hackers mailing list