[theme-reviewers] wp_enqueue_style
Chip Bennett
chip at chipbennett.net
Fri Jun 3 11:27:50 UTC 2011
I don't understand why using priority numbers, for their intended purpose,
is "annoying" or "weird"?
I'm all for recommending best practice, whatever that may be; I'm just
surprised that until now we've not heard anyone suggest this method,
although we've been discussing style enqueueing for almost a year.
Chip
On Fri, Jun 3, 2011 at 6:17 AM, Otto <otto at ottodestruct.com> wrote:
> On Fri, Jun 3, 2011 at 6:02 AM, Chip Bennett <chip at chipbennett.net> wrote:
> > Wait: you want to enqueue a *style* at 'wp_enqueue_scripts'? Or was that
> a
> > typo?
>
> No, not a typo.
>
> There is no wp_enqueue_styles action hook, but if there was, then it
> would be at the same time/place that the existing wp_enqueue_scripts
> action hook is.
>
> The reason to enqueue at that time is because that gives the rest of
> the code time to potentially dequeue the script/style before it
> prints. If you wait until wp_print_styles to enqueue, then the only
> way you can possibly dequeue is to hook to wp_print_styles again with
> a larger priority number, which is annoying and weird.
>
> Again, enqueue early, dequeue late.
>
> Styles and scripts destined for the front end of the site should both
> be hooked into the wp_enqueue_scripts action hook.
>
> -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/e1a458df/attachment-0001.htm>
More information about the theme-reviewers
mailing list