[wp-hackers] Adding JS to a Page based upon the used shortcodes
Alexander Beutl
xel at netgra.de
Sat May 3 11:11:54 GMT 2008
>
> as all of the js effects scripts run "on dom loaded" and can be included
> just above the </body> tag.
Know what? This seems obviously the best way to do it. This would be even
better than scanning the codes since it wouldn't require additional
computing time, just an array to be filled. Thanks!
2008/5/2 Andrew Ozz <admin at laptoptips.ca>:
> Alexander Beutl wrote:
>
> > Thanks Casey and Otto,
> > that seems to do the trick at least for "standard templates" with only a
> > single loop.
> >
> > the only remaining thing is:
> > I will also need to know which methods are used inside the template -
> > but
> > there I may aks the user to specify which scripts should be enqueued on
> > each
> > page load because they are used in template... (I think this is still
> > better
> > then scanning all template files which would be an enormous performance
> > waste).
> >
> > Maybe I will add a fallback to add the script in body when it wasn't
> > added
> > to head allready since this is still better than if it's missing.
> >
>
> Could try using get_footer() (not wp_footer() that's missing from a lot of
> themes), as all of the js effects scripts run "on dom loaded" and can be
> included just above the </body> tag. Then you could check for all scripts
> included in the header and all calls coming from templates and shortcodes.
>
> _______________________________________________
> 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