[wp-trac] [WordPress Trac] #21162: Add !IE conditional comment on $wp_styles->add_data
WordPress Trac
wp-trac at lists.automattic.com
Thu Jul 5 11:21:27 UTC 2012
#21162: Add !IE conditional comment on $wp_styles->add_data
-------------------------+-----------------------------
Reporter: Umbercode | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 3.4
Severity: normal | Keywords:
-------------------------+-----------------------------
There is no way to use `$wp_styles->add_data("css_ie", "conditional",
"!IE");` and target non-IE browsers.
There are use cases for this for example:
{{{
<!--[if (gt IE 8) | (IEMobile)]><!-->
<link rel='stylesheet' href='<?php bloginfo("template_url");
?>/css/style.css'><!--<![endif]-->
<!--[if (lt IE 9) & (!IEMobile)]>
<link rel='stylesheet' href='<?php bloginfo("template_url");
?>/css/ie.css'><![endif]-->
}}}
I do not know how to attach a patch or diff file but I changed the code in
class.wp-styles.php between lines 69 and 75 to:
{{{
if ( isset($obj->extra['conditional']) && $obj->extra['conditional'] ) {
if (strpos(strtoupper($obj->extra['conditional']), "!IE")) {
$tag .= "<!--[if {$obj->extra['conditional']}]><!-->\n";
$end_cond = "<!--<![endif]-->\n";
}
else {
$tag .= "<!--[if {$obj->extra['conditional']}]>\n";
$end_cond = "<![endif]-->\n";
}
}}}
which seems to work.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/21162>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list