[wp-hackers] Re: Plugins & CSS, embeded vs linking

Aaron Brazell emmensetech at gmail.com
Mon Jul 14 18:28:03 GMT 2008


On Mon, Jul 14, 2008 at 2:23 PM, Joost de Valk <joost at joostdevalk.nl> wrote:

> On Jul 14, 2008, at 8:20 PM, Aaron Brazell wrote:
>
>  What's wrong with wp_head? That's a standard hook in the header. Of
>> course,
>> there's nothing that enforces a theme developer put the wp_head() function
>> before the closing </head> but most do I think.
>>
>> function plugin_css()
>> {
>>  echo '<link rel="stylesheet" href="' . ABSPATH .
>> '/wp-content/plugin/your-very-nice-plugin/customstyle.css" type="text/css"
>> />';
>> }
>> add_action('wp_head','plugin_css');
>>
>>
> I know that's what I do, get's you multiple linked files though... If there
> were a mechanism in which you could add some css, and that would ALL be
> added to 1 big css file, that'd save a couple of includes. But anyway,
> Jonathan had a problem with it, I don't :)
>
> Cheers,
> Joost
>

Sounds like maybe what we need is a wp_enqueue_style() for themes and build
that functionality as an automatic hook on wp_head(). I know last month when
this was being discussed on the wp-admin side, the argument was that theme
authors aren't consistent with how they develop themes and that it wasn't
our place to be enforcing those kinds of restrictions (my words not
whomever).

However, gut instinct says that 99% of publicly available themes have the
wp_head() functionality so why don't we leverage that to bring some
structure to bear without enforcing "rules" on those free-spirited designer
types. :-)


More information about the wp-hackers mailing list