[wp-hackers] checking if post has shortcode, before header is output?

Austin Matzko if.website at gmail.com
Mon Oct 26 19:01:42 UTC 2009

On Mon, Oct 26, 2009 at 1:59 PM, Aaron D. Campbell <aaron at xavisys.com> wrote:
> I still think it would be better to add the JS from the shortcode handler
> rather than trying to mess with the_content, the_post, $wp_query, $post,
> etc.  Since it's enqueued inside the shortcode handler you KNOW the
> shortcode is being executed.  The only drawback is that the JS needs to go
> in the footer rather than the header, but as far as I know this is actually
> the recommended way of loading JS so you should code for that anyway.

That's probably the best way for JavaScript, but valid CSS <style>
elements are supposed to be in <head>.

More information about the wp-hackers mailing list