[wp-hackers] Adding JS to a Page based upon the used shortcodes

Alexander Beutl xel at netgra.de
Fri May 2 11:13:17 GMT 2008


I am working on an image gallerie plugin using the new shortcodes and I want
to add some options to define
a) how the gallerie should look
b) which JS is used (thickbox, lytebox, jQuery Lightbox, and some others,
which will do really different things like slideshows, flash like galleries,
carousels and stuff)

While I could make this be defined consistantly between all pages when using
options, I want to make it costomizable per Post (or per Gallerie I should
say, since one could use more then one gallerie and one could use a gallerie
in template) using attributes in the shortcodes.

I know about the wp_enqueue_script command but this doesn't work when called
inside the shortcode function since this is much to late (head is out
allready) - and I do not know about any functionality how to know about the
used shortcodes before I am in the shortcode function. Is there any way to
do this?

Yes maybe it would work to write the JS directly into the body but this
isn't a good solution. Any ideas?


More information about the wp-hackers mailing list