Add conditional link for IE


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. How to add conditional comments to enqueued/registered styles for IE.
  2.  
  3. In functions.php:
  4.  
  5. wp_enqueue_style('internet-explorer', 'path/to/ie.css', false, '1.0', 'screen');
  6. $wp_styles->add_data( 'internet-explorer', 'conditional', 'lt IE 7' ); // or lt IE 6 or lt IE 8 or whatever.
  7.  
  8.  
  9. This will result in:
  10.  
  11. <!--[if lt IE 7]>
  12. <link rel='stylesheet' id='internet-explorer-css' href='path/to/ie6.css?ver=1.0' type='text/css' media='screen' />
  13. <![endif]-->
  14.  
  15.  
  16. Example:
  17. $wp_styles->add_data( 'ie', 'conditional', 'lt IE 7' ); // or lt IE 6 or lt IE 8 or whatever.

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.