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

Ade Walker photofantaisie at gmail.com
Sat Nov 29 14:14:20 GMT 2008


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.


More information about the wp-hackers mailing list