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 ars technica

  • Apple chooses Amazon satellites for iPhone, years after rejecting Starlink offer
  • Apple and Lenovo have the least repairable laptops, analysis finds
  • Running local models on Macs gets faster with Ollama's MLX support
  • Apple pulls the plug on its high-priced, oft-neglected Mac Pro desktop
  • Apple confirms that its Maps app will begin showing ads to users "this summer"

RSS mac surfer

  • App Store Hosts AI Nudify Apps Despite Ban
  • iPad Air to Gain OLED Display in 2027
  • Apple Releases iOS 26.5 Public Beta 2
  • Amazon Acquires Globalstar for Satellite Services
  • iPhone Fold Production Delayed but Fall 2026 Launch Holds

Donate

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

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