-
-
Save shramee/fe1fbb97b06f33182a46fa409a1c88e8 to your computer and use it in GitHub Desktop.
Revisions
-
wpscholar revised this gist
Aug 4, 2016 . 1 changed file with 44 additions and 42 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,47 +2,49 @@ add_action( 'wp_enqueue_scripts', 'enqueue_my_styles' ); /** * Example callback function that demonstrates how to properly enqueue conditional stylesheets in WordPress for IE. * IE10 and up does not support conditional comments in standards mode. * * @uses wp_style_add_data() WordPress function to add the conditional data. * @link https://developer.wordpress.org/reference/functions/wp_style_add_data/ * @link https://msdn.microsoft.com/en-us/library/ms537512(v=vs.85).aspx */ function enqueue_my_styles() { // Load the main stylesheet wp_enqueue_style( 'my-theme', get_stylesheet_uri() ); /** * Load our IE-only stylesheet for all versions of IE: * <!--[if IE]> ... <![endif]--> */ wp_enqueue_style( 'my-theme-ie', get_stylesheet_directory_uri() . "/css/ie.css", array( 'my-theme' ) ); wp_style_add_data( 'my-theme-ie', 'conditional', 'IE' ); /** * Load our IE version-specific stylesheet: * <!--[if IE 7]> ... <![endif]--> */ wp_enqueue_style( 'my-theme-ie7', get_stylesheet_directory_uri() . "/css/ie7.css", array( 'my-theme' ) ); wp_style_add_data( 'my-theme-ie7', 'conditional', 'IE 7' ); /** * Load our IE specific stylesheet for a range of older versions: * <!--[if lt IE 9]> ... <![endif]--> * <!--[if lte IE 8]> ... <![endif]--> * NOTE: You can use the 'less than' or the 'less than or equal to' syntax here interchangeably. */ wp_enqueue_style( 'my-theme-old-ie', get_stylesheet_directory_uri() . "/css/old-ie.css", array( 'my-theme' ) ); wp_style_add_data( 'my-theme-old-ie', 'conditional', 'lt IE 9' ); /** * Load our IE specific stylesheet for a range of newer versions: * <!--[if gt IE 8]> ... <![endif]--> * <!--[if gte IE 9]> ... <![endif]--> * NOTE: You can use the 'greater than' or the 'greater than or equal to' syntax here interchangeably. */ wp_enqueue_style( 'my-theme-new-ie', get_stylesheet_directory_uri() . "/css/new-ie.css", array( 'my-theme' ) ); wp_style_add_data( 'my-theme-ie', 'conditional', 'gt IE 8' ); } -
wpscholar revised this gist
Aug 8, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ function enqueue_my_styles() { global $wp_styles; // Load the main stylesheet wp_enqueue_style( 'my-theme', get_stylesheet_uri() ); /** * Load our IE-only stylesheet for all versions of IE: -
wpscholar revised this gist
Jul 1, 2013 . 1 changed file with 5 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ function enqueue_my_styles() { global $wp_styles; // Load the main stylesheet wp_enqueue_style( 'my-theme', get_stylesheet_directory_uri() . '/style.css' ); /** * Load our IE-only stylesheet for all versions of IE: @@ -18,14 +18,14 @@ function enqueue_my_styles() { * EXCEPT for IE, then you would HAVE to check the $is_IE global since WordPress doesn't have a way to * properly handle non-IE conditional comments. */ wp_enqueue_style( 'my-theme-ie', get_stylesheet_directory_uri() . "/css/ie.css", array( 'my-theme' ) ); $wp_styles->add_data( 'my-theme-ie', 'conditional', 'IE' ); /** * Load our IE version-specific stylesheet: * <!--[if IE 7]> ... <![endif]--> */ wp_enqueue_style( 'my-theme-ie7', get_stylesheet_directory_uri() . "/css/ie7.css", array( 'my-theme' ) ); $wp_styles->add_data( 'my-theme-ie7', 'conditional', 'IE 7' ); /** @@ -34,7 +34,7 @@ function enqueue_my_styles() { * <!--[if lte IE 8]> ... <![endif]--> * NOTE: You can use the 'less than' or the 'less than or equal to' syntax here interchangeably. */ wp_enqueue_style( 'my-theme-old-ie', get_stylesheet_directory_uri() . "/css/old-ie.css", array( 'my-theme' ) ); $wp_styles->add_data( 'my-theme-old-ie', 'conditional', 'lt IE 9' ); /** @@ -43,6 +43,6 @@ function enqueue_my_styles() { * <!--[if gte IE 9]> ... <![endif]--> * NOTE: You can use the 'greater than' or the 'greater than or equal to' syntax here interchangeably. */ wp_enqueue_style( 'my-theme-new-ie', get_stylesheet_directory_uri() . "/css/new-ie.css", array( 'my-theme' ) ); $wp_styles->add_data( 'my-theme-new-ie', 'conditional', 'gt IE 8' ); } -
wpscholar revised this gist
Feb 17, 2013 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,8 +13,10 @@ function enqueue_my_styles() { * Load our IE-only stylesheet for all versions of IE: * <!--[if IE]> ... <![endif]--> * * NOTE: It is also possible to just check and see if the $is_IE global in WordPress is set to true before * calling the wp_enqueue_style() function. If you are trying to load a stylesheet for all browsers * EXCEPT for IE, then you would HAVE to check the $is_IE global since WordPress doesn't have a way to * properly handle non-IE conditional comments. */ wp_enqueue_style( 'my-theme-ie', get_template_directory_uri() . "/css/ie.css", array( 'my-theme' ) ); $wp_styles->add_data( 'my-theme-ie', 'conditional', 'IE' ); -
wpscholar revised this gist
Feb 17, 2013 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,6 +12,9 @@ function enqueue_my_styles() { /** * Load our IE-only stylesheet for all versions of IE: * <!--[if IE]> ... <![endif]--> * * NOTE: If trying to load a stylesheet for all browsers EXCEPT for IE, just check to see if the $is_IE * global in WordPress is set to false before enqueuing your stylesheet. */ wp_enqueue_style( 'my-theme-ie', get_template_directory_uri() . "/css/ie.css", array( 'my-theme' ) ); $wp_styles->add_data( 'my-theme-ie', 'conditional', 'IE' ); -
wpscholar revised this gist
Feb 15, 2013 . 1 changed file with 5 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,24 +18,24 @@ function enqueue_my_styles() { /** * Load our IE version-specific stylesheet: * <!--[if IE 7]> ... <![endif]--> */ wp_enqueue_style( 'my-theme-ie7', get_template_directory_uri() . "/css/ie7.css", array( 'my-theme' ) ); $wp_styles->add_data( 'my-theme-ie7', 'conditional', 'IE 7' ); /** * Load our IE specific stylesheet for a range of older versions: * <!--[if lt IE 9]> ... <![endif]--> * <!--[if lte IE 8]> ... <![endif]--> * NOTE: You can use the 'less than' or the 'less than or equal to' syntax here interchangeably. */ wp_enqueue_style( 'my-theme-old-ie', get_template_directory_uri() . "/css/old-ie.css", array( 'my-theme' ) ); $wp_styles->add_data( 'my-theme-old-ie', 'conditional', 'lt IE 9' ); /** * Load our IE specific stylesheet for a range of newer versions: * <!--[if gt IE 8]> ... <![endif]--> * <!--[if gte IE 9]> ... <![endif]--> * NOTE: You can use the 'greater than' or the 'greater than or equal to' syntax here interchangeably. */ wp_enqueue_style( 'my-theme-new-ie', get_template_directory_uri() . "/css/new-ie.css", array( 'my-theme' ) ); -
wpscholar created this gist
Feb 13, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,43 @@ <?php add_action( 'wp_enqueue_scripts', 'enqueue_my_styles' ); function enqueue_my_styles() { global $wp_styles; // Load the main stylesheet wp_enqueue_style( 'my-theme', get_template_directory_uri() . '/style.css' ); /** * Load our IE-only stylesheet for all versions of IE: * <!--[if IE]> ... <![endif]--> */ wp_enqueue_style( 'my-theme-ie', get_template_directory_uri() . "/css/ie.css", array( 'my-theme' ) ); $wp_styles->add_data( 'my-theme-ie', 'conditional', 'IE' ); /** * Load our IE version-specific stylesheet: * <!--[if IE 7]><!--> ... <!--<![endif]--> */ wp_enqueue_style( 'my-theme-ie7', get_template_directory_uri() . "/css/ie7.css", array( 'my-theme' ) ); $wp_styles->add_data( 'my-theme-ie7', 'conditional', 'IE 7' ); /** * Load our IE specific stylesheet for a range of older versions: * <!--[if lt IE 9]><!--> ... <!--<![endif]--> * <!--[if lte IE 8]><!--> ... <!--<![endif]--> * NOTE: You can use the 'less than' or the 'less than or equal to' syntax here interchangeably. */ wp_enqueue_style( 'my-theme-old-ie', get_template_directory_uri() . "/css/old-ie.css", array( 'my-theme' ) ); $wp_styles->add_data( 'my-theme-old-ie', 'conditional', 'lt IE 9' ); /** * Load our IE specific stylesheet for a range of newer versions: * <!--[if gt IE 8]><!--> ... <!--<![endif]--> * <!--[if gte IE 9]><!--> ... <!--<![endif]--> * NOTE: You can use the 'greater than' or the 'greater than or equal to' syntax here interchangeably. */ wp_enqueue_style( 'my-theme-new-ie', get_template_directory_uri() . "/css/new-ie.css", array( 'my-theme' ) ); $wp_styles->add_data( 'my-theme-new-ie', 'conditional', 'gt IE 8' ); }