[theme-reviewers] wp_enqueue_style

Philip M. Hofer (Frumph) philip at frumph.net
Fri Jun 3 11:13:34 UTC 2011


Yeah just a typo there, wp_enqueue_style(); should be used whenever possible

*UNLESS*  It’s an ordering situation where a style needs to load before everything else or directly after the base style.css





From: Chip Bennett 
Sent: Friday, June 03, 2011 4:02 AM
To: theme-reviewers at lists.wordpress.org 
Subject: Re: [theme-reviewers] wp_enqueue_style

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




--------------------------------------------------------------------------------
_______________________________________________
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/1e8a5431/attachment.htm>


More information about the theme-reviewers mailing list