Coolest Guides on the Planet

coolest guides on the planet

Coolest Guides On The Planet

  • Home
  • macOS
  • WebDev
  • All Posts
  • Contact

Enqueue and Register Internet Explorer CSS Style Sheets in WordPress

February 2, 2014 3 Comments

ie-register-enqueue
To  enqueue and register IE stylesheets in WordPress as appose to manually hardcoding them into a header.php file you need to add a function with the style sheet registered and enqueued and then add an action to load the stylesheet, the function also needs to contain the conditions of which IE version is targeted.

Add in a function and action

Open up functions.php and add in a function and action like so:

function ie_style_sheets () {
//code goes here
}

add_action ('wp_enqueue_scripts','ie_style_sheets');

The function in this example is named ie_style_sheets(), you can name it what you like, the action wp_enqueue_scripts is going to load the function ie_style_sheets with all styles and scripts inside it.

 

Register and Enqueue the style sheet

function ie_style_sheets () {
wp_register_style( 'ie8', get_stylesheet_directory_uri() . '/ie8.css'  );

wp_enqueue_style( 'ie8' );
}

add_action ('wp_enqueue_scripts','ie_style_sheets');

The above for instance will target just IE8, register the style sheet and enqueue it.

 

Add in the IE Conditions

function ie_style_sheets () {
wp_register_style( 'ie8', get_stylesheet_directory_uri() . '/ie8.css'  );
$GLOBALS['wp_styles']->add_data( 'ie8', 'conditional', 'lte IE 8' );

wp_enqueue_style( 'ie8' );
}

add_action ('wp_enqueue_scripts','ie_style_sheets');

The above for instance will target just IE8 and lower .

 

Add in Multiple Variations if Required

function ie_style_sheets () {
wp_register_style( 'ie8', get_stylesheet_directory_uri() . '/ie8.css'  );
$GLOBALS['wp_styles']->add_data( 'ie8', 'conditional', 'lte IE 9' );

wp_register_style( 'ie6', get_stylesheet_directory_uri() . '/ie6.css'  );
$GLOBALS['wp_styles']->add_data( 'ie6', 'conditional', 'lt IE 7' );

wp_enqueue_style( 'ie8' );
wp_enqueue_style( 'ie6' );
}

add_action ('wp_enqueue_scripts','ie_style_sheets');

One of the key benefits of setting it up like this is that you can bundle in all your styles and scripts into one function.

Cats: CSS, WordPress Tags: ie

Tags

3gs 10.6 apache backup baseband boot clean urls cpanel css curl custom database drupal el capitan git Google image instadmg ios iphone jailbreak keys lion mac macos mojave macos sierra menu mysql OSX panda php phpmyadmin private public redirect redsn0w remote rsa SEO shell ssh terminal unstoppables upgrade urls

Donate a Beer to the Coolest Guides

Get Beaver Builder Now!

Discuss

3gs 10.6 apache backup baseband boot clean urls cpanel css curl custom database drupal el capitan git Google image instadmg ios iphone jailbreak keys lion mac macos mojave macos sierra menu mysql OSX panda php phpmyadmin private public redirect redsn0w remote rsa SEO shell ssh terminal unstoppables upgrade urls
Get DesktopServer

Lynda

Lynda.com Online Training Videos

TreeHouse

smlinks

Learn WordPress
osx-modify-shell-path

How to Add to the Shell Path in macOS Big Sur and Catalina using Terminal

October 19, 2019

virtual-hosts osx 10.10 yosemite

Set up Virtual Hosts on macOS Catalina 10.15 in Apache

October 19, 2019

Installing Homebrew on macOS Catalina 10.15, Package Manager for Linux Apps

October 18, 2019

Where is the bash shell in macos Catalina?

October 12, 2019

Refine your search

  • All
  • Modules
  • Themes
  • Documentation
  • Forums & Issues
  • Groups

RSS feed: ars technica ars technica

  • Apple One and Apple TV subscription prices increase by up to 20 percent
  • Vulnerability giving attackers full control of Macs is under active exploitation
  • OpenAI says Apple's trade secrets lawsuit is "aggressive and oddly personal"
  • Tim Cook passes the baton in Apple's Q3 2026 earnings call
  • San Francisco orders Apple, Google to remove nudify apps from app stores

RSS feed: mac surfer mac surfer

  • Mac App Store Lets Developers Drop Intel Support
  • Ternus Sends First CEO Memo, Teases iPhone Launch
  • Apple CEO John Ternus Joins X With 'Hello' Post
  • John Ternus Takes Over as Apple CEO
  • Apple Files New Evidence in OpenAI Trade Secret Suit

Donate

Copyright © 2026· Neil Gee - All Rights Reserved - Hosted by Runcloud

Copyright © 2026 · gee on Genesis Framework · WordPress · Log in