[theme-reviewers] wp_enqueue_script

Chip Bennett chip at chipbennett.net
Wed Sep 15 15:21:04 UTC 2010


Okay, I suggested the template_redirect() hook in the ticket.

But, what we really need is what the official best-practice suggestion will
be, for the purposes of the Guidelines. We need to ensure that all reviewers
will be making consistent suggestions with respect to wp_enqueue_script()
within functions.php.

Chip

On Wed, Sep 15, 2010 at 10:09 AM, Austin Matzko <austin at pressedcode.com>wrote:

> On Wed, Sep 15, 2010 at 9:56 AM, Chip Bennett <chip at chipbennett.net>
> wrote:
> > Hmm... I'm completely unfamiliar with the template_redirect hook - and, I
> > thought enqueueing scripts was one of the uses of wp_head()? (Learning
> > something new every day, I guess!)
> > So, should I recommend hooking into template_redirect(), or wp_footer() -
> or
> > either, or both?
>
> template_redirect is the last action hook before the actual template
> file is included and executed.
>
> You could also use the wp_enqueue_scripts action hook to attach your
> enqueuing callbacks; wp_enqueue_scripts is called early in wp_head.
> However, I prefer template_redirect because it's late enough that WP
> has parsed the request (so is_singular() and the like are available)
> but it's prior to the actual template file's being included, so if the
> theme queries posts on its own prior to that point I don't have to
> worry about resetting $wp_query.
>
> Whatever works for you, but default wp_head without a high priority is too
> late.
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20100915/2105101b/attachment-0001.htm>


More information about the theme-reviewers mailing list