Home / functions.php / Display a different theme for IE6
  • How to Display a different theme for IE6

    no thumbnail sorry: Display a different theme for IE6

    Adding this to your functions.php will let you automatically change the theme for IE6 users.

    ( click code to copy )

    wordpress snippet : PHP

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

    ( WordPress codex functions, hooks, in this snippet. )

    template, stylesheet, add_filter,
  • Could you just pick different template parts of the same theme instead? Like ie6.php, header-ie6.php, footer-ie6.php, etc. Or different stylesheet with same template parts?

    • You could this is true, this is just a method that you may want to use and could be used for other browsers not just IE. However some would use it to display a theme that asks the user to upgrade to a good browser. Chrome, Firefox, Safari, Opera, etc.