[wp-hackers] Load scripts in header only when needed

Ozh ozh at planetozh.com
Sat Nov 29 17:48:11 GMT 2008


Should help :
<http://planetozh.com/blog/2008/04/how-to-load-javascript-with-your-wordpress-plugin/>

On Sat, Nov 29, 2008 at 3:14 PM, Ade Walker <photofantaisie at gmail.com> wrote:
> Hi all,
>
> I've probably been staring at the computer screen too long, but I'm
> struggling to get my head around this...
>
> I'm playing around with a new gallery plugin which uses javascript. The
> gallery will be called by a function call in a theme template file. However,
> I only want to load the scripts into the header on pages that actually need
> it.  The problem is that if I try to load the scripts into the head based on
> the template function call it's too late - wp_head has been and gone.
>
> If anyone could point me in the right direction I'd be very grateful. :-)
>
> Thanks.
>
> Ade.
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



-- 
http://planetOzh.com ~ Blog and WordPress Stuff
http://FrenchFragFactory.net ~ Daily Quake News


More information about the wp-hackers mailing list