[theme-reviewers] enqueue conditional CSS?
Konstantin Obenland
konstantin at obenland.it
Wed May 16 16:54:36 UTC 2012
Endorsements towards #18753, to make this even easier to use, are always welcome! :)
Konstantin
On 16.05.2012, at 18:50, Chip Bennett wrote:
> What Konstantin said. I recommend this method as best practice.
>
> Chip
>
> On 5/16/12, Konstantin Obenland <konstantin at obenland.it> wrote:
>> How about:
>>
>> function prefix_enqueue_scripts() {
>> wp_enqueue_style( 'handle', get_template_directory_uri() . '/ie.css',
>> array('style') );
>>
>> global $wp_styles;
>> $wp_styles->add_data( 'handle', 'conditional', 'lt IE 9' );
>> }
>> add_action( 'wp_enqueue_scripts', 'prefix_enqueue_scripts' );
>>
>> Konstantin
>>
>>
>> On 16.05.2012, at 17:18, Sayontan Sinha wrote:
>>
>>> Actually you can use wp_enqueue_style for this, by combining with the
>>> style_loader_tag filter. E.g.:
>>>
>>> add_filter('style_loader_tag', 'suffusion_filter_rounded_corners_css', 10,
>>> 2);
>>> function suffusion_filter_rounded_corners_css($css_html_tag, $handle) {
>>> if ($handle == 'suffusion-rounded') {
>>> return "<!--[if !IE]>-->".$css_html_tag."<!--<![endif]-->\n<!--[if
>>> gt IE 8]>".$css_html_tag."<![endif]-->\n";
>>> }
>>> return $css_html_tag;
>>> }
>>>
>>>
>>> On Wed, May 16, 2012 at 8:14 AM, .: chris :. <chris at jazzsequence.com>
>>> wrote:
>>> Why not use conditional classes instead of conditional stylesheets?
>>> http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/
>>>
>>> :: code bandit ::
>>> http://protocol.by/jazzsequence
>>> http://about.me/jazzs3quence
>>>
>>> On May 16, 2012, at 9:11 AM, Shinra Web Holdings wrote:
>>>
>>>> Are themes still permitted to load browser-conditional style sheets using
>>>> <!--[if IE 7]><link rel="stylesheet" href="ie7.css" type="text/css"
>>>> media="screen" /><![endif]--> or are they required to discover the
>>>> browser using PHP and use wp_enqueue_style() ?
>>>> _______________________________________________
>>>> 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
>>>
>>>
>>>
>>>
>>> --
>>> Sayontan Sinha
>>> http://mynethome.net | http://mynethome.net/blog
>>> --
>>> Beating Australia in Cricket is like killing a celebrity. The death gets
>>> more coverage than the crime.
>>>
>>> _______________________________________________
>>> theme-reviewers mailing list
>>> theme-reviewers at lists.wordpress.org
>>> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>>
>>
>
> --
> Sent from my mobile device
> _______________________________________________
> 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/20120516/49b51556/attachment.htm>
More information about the theme-reviewers
mailing list