I seem to remember running into a problem where a registered style was enqueued and hooked into 'wp_enqueue_styles', but the link never printed (which IIRC, was where the original recommendation - from Nacin, perhaps? - to use 'wp_print_styles' came from).<div>
<br></div><div>It would be good to have a recommended implementation - e.g. "ideally, hook in to *this* hook, but in any case, hook in no sooner than *this* hook, but also no later than *this* hook" (that is, if we can't just settle on a given hook, to say "enqueue styles on *this* hook, period").</div>
<div><br></div><div>Chip<br><br><div class="gmail_quote">On Fri, Jun 3, 2011 at 6:27 AM, Philip M. Hofer (Frumph) <span dir="ltr"><<a href="mailto:philip@frumph.net">philip@frumph.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Otto, it shouldn't make a difference (entirely)* when you hook it in, because the wp action for the wp_enqueue places it in the process at the appropriate time regardless. * Entirely - meaning of course use a close approximation for the triggering of it, after_page_load would be just a bit off.<br>
<br>
You could do it at 'init' with everything else and it will still process it in the enqueue at the appropriate place - you just don’t want to hook it into the print because by that time it's a little late in the game and should be used for dequeue.<br>
<br>
I would actually recommend putting wp_enqueue_(script/style) in the themes init location; whether it uses init or some other action location at that time it's best to do it when the theme itself is triggering of registered variables that are used throughout the theme instead of intensifying the codes confusion.<br>
<br>
<br>
<br>
<br>
-----Original Message----- From: Otto<br>
Sent: Friday, June 03, 2011 4:17 AM<br>
To: <a href="mailto:theme-reviewers@lists.wordpress.org" target="_blank">theme-reviewers@lists.wordpress.org</a><div class="im"><br>
Subject: Re: [theme-reviewers] wp_enqueue_style<br>
<br></div><div><div></div><div class="h5">
On Fri, Jun 3, 2011 at 6:02 AM, Chip Bennett <<a href="mailto:chip@chipbennett.net" target="_blank">chip@chipbennett.net</a>> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Wait: you want to enqueue a *style* at 'wp_enqueue_scripts'? Or was that a<br>
typo?<br>
</blockquote>
<br>
No, not a typo.<br>
<br>
There is no wp_enqueue_styles action hook, but if there was, then it<br>
would be at the same time/place that the existing wp_enqueue_scripts<br>
action hook is.<br>
<br>
The reason to enqueue at that time is because that gives the rest of<br>
the code time to potentially dequeue the script/style before it<br>
prints. If you wait until wp_print_styles to enqueue, then the only<br>
way you can possibly dequeue is to hook to wp_print_styles again with<br>
a larger priority number, which is annoying and weird.<br>
<br>
Again, enqueue early, dequeue late.<br>
<br>
Styles and scripts destined for the front end of the site should both<br>
be hooked into the wp_enqueue_scripts action hook.<br>
<br>
-Otto<br>
_______________________________________________<br>
theme-reviewers mailing list<br>
<a href="mailto:theme-reviewers@lists.wordpress.org" target="_blank">theme-reviewers@lists.wordpress.org</a><br>
<a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers" target="_blank">http://lists.wordpress.org/mailman/listinfo/theme-reviewers</a> <br>
_______________________________________________<br>
theme-reviewers mailing list<br>
<a href="mailto:theme-reviewers@lists.wordpress.org" target="_blank">theme-reviewers@lists.wordpress.org</a><br>
<a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers" target="_blank">http://lists.wordpress.org/mailman/listinfo/theme-reviewers</a><br>
</div></div></blockquote></div><br></div>