Coolest Guides on the Planet

coolest guides on the planet

Coolest Guides On The Planet

  • Home
  • macOS
  • WebDev
  • All Posts
  • Contact

Create CSS Conditional Stylesheets for Internet Explorer in WordPress

February 1, 2014 2 Comments

ie-support wordpressHow to Create  CSS conditional style sheets  for Internet Explorer in WordPress using a child theme or parent theme.

Either manually in the header.php file or the preferred WordPress way registered and enqueued as a style via the functions.php way.

The Manual Header Way

1) Open the header.php to your parent or child theme

2) Edit the file and go where the CSS styles are  before the closing </head> tag – here you are going to insert an Internet Explorer conditional style based on the IE version. Load the conditional styles after the other CSS styles.

Notes on the code

The source of the style sheet is given by the href attribute:

href="/css/all-ie.css"

The <?php echo get_stylesheet_directory_uri(); ?> followed by the css path is preferred as the better way to declare the theme location rather than use the absolute URL like:

http://mydomain.com/wp-content/mytheme/css/all-ie.css

The get_stylesheet_directory_uri(); function is used to point to the child theme root location – if you are altering a parent master theme then swap in the  get_template_directory_uri(); function instead to point to the parent theme location.

Target all IE versions using Child Theme

This examples targets all IE using Parent Theme – rest of examples below use Child Theme

Target all IE versions using Parent Theme

This examples targets all IE using Parent Theme – rest of examples below use Child Theme

Target Specific IE version

This example uses IE8 as an example. Just swap in the IE version number to suit.

Target IE Version & Lower

This example uses targets version 8 and lower, lte=lower than and equal

Target IE Lower

This example uses targets version 7 and lower, lt=lower than but not equal (oh the subtlety)

Target IE Version & Higher

This example uses targets version 9 and higher, gte=greater than and equal

Target IE Higher

This example uses targets version 9 and higher, gt=greater than  but not equal

You will also likely find that a parent theme already has IE conditional style sheets already set up – check the header.php for the script tag and where the CSS file path is – if this is the case simply locate the CSS file and add in your IE style rules. IE versions above 10 do not support conditional stylesheets.

The other way to do this is by using the register and enqueue method but with the conditional tags there is a bit more code – check this.

Cats: Theming, WordPress Tags: browser, css, internet explorer

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

  • Google hits back after Apple exec says AI is hurting search
  • Apple: “Hundreds of millions to billions” lost without App Store commissions
  • Matter update may finally take the tedium out of setting up your smart home
  • Cue: Apple will add AI search in mobile Safari, challenging Google
  • Apps like Kindle are already taking advantage of court-mandated iOS App Store changes

RSS mac surfer

  • Tot is new text editor for Mac, iPhone, and iPad focused on constraints and ease of use
  • TiPbITS: Google Drive Sorting Can Hide New Documents
  • How to take a screenshot on a MacBook Pro
  • How To Create Simple Animation With Mac Keynote
  • Last Week on My Mac: Virus pandemics

Donate

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

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