[theme-reviewers] wp_enqueue_style

Chip Bennett chip at chipbennett.net
Fri Jun 3 11:02:18 UTC 2011


Wait: you want to enqueue a *style* at 'wp_enqueue_scripts'? Or was that a
typo?

Chip

On Fri, Jun 3, 2011 at 5:54 AM, Otto <otto at ottodestruct.com> wrote:

> On Fri, Jun 3, 2011 at 5:48 AM, Vicky Arulsingam
> <vicky.arulsingam at gmail.com> wrote:
> >> I see a few issues:
> >> 1) Styles should be enqueued and *hooked* in; front-end styles should be
> >> hooked into 'wp_print_styles'.
> >
> > I've seen a number of themes that use wp_enqueue_style() /
> wp_enqueue_script
> > within the header.php.  I'll be sure to distinguish between
> wp_print_style
> > and wp_enqueue_style in future reviews.
>
> No, enqueueing of styles for the front end of the site should be in a
> function hooked to the wp_enqueue_scripts action, *not* to
> wp_print_styles.
>
> Correct way:
>
> add_action('wp_enqueue_scripts','my_enqueue_stuff');
> function my_enqueue_stuff() {
>  wp_enqueue_styles(...);
> }
>
> The reason for this is that wp_print_styles is the last possible
> moment to enqueue a style, and so it should be reserved for
> *dequeueing* styles instead. Enqueue early, dequeue late.
>
> -Otto
> _______________________________________________
> 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/20110603/782675c7/attachment.htm>


More information about the theme-reviewers mailing list