Forcing A Different Theme For IE6 Users

Snippets, Tutorials | By | 20 January 2011 | Comments 2

IE6 is somehow still some users browser of choice, or are restricted by work computers that still run IE6.

For developers this is an ongoing nightmare as many designs have to be fixed up to support IE6, whether design elements are changed or conditional stylesheets are used it’s still more work than we really need to do.

This snippet will force IE6 users to view the default template leaving your design viewable by users with modern browsers only, thus saving time on IE6 bug fixing.

This following snippet is added to functions.php so remember to backup first.

add_filter('template', 'default_ie');
add_filter('option_template', 'default_ie');
add_filter('option_stylesheet', 'default_ie');
function default_ie($theme) {
if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6') !== false)
$theme = 'default';
return $theme;
}

Now this might seem like browser discrimination, but at some point developers need to stop supporting IE6 so it can gracefully step aside for more modern browsers. This will never happen if we keep spending time supporting it and making it’s shelf life even longer!

Read more about Bringing Down IE6 here: bringdownie6.com

Paul Maloney is a UK based web designer/developer and runs the design agency Tropica. He particularly enjoys using and working with WordPress and has a keen interest in typography. You can also follow Paul on Twitter.

Visit Paul Maloney's website

2 Comments

  • January 20, 2011
    • January 20, 2011

Leave A Comment.