Support » Themes and Templates » _s Underscores theme conditional stylesheet

  • Resolved Becky Davis


    WCEU 2016 Contributor

    I have a site built with the Underscores theme where there are 2 background images. IE8 and below don’t like this, so I’ve added a conditional stylesheet. Despite having done this on other sites, I cannot get this one to read properly. This theme’s regular stylesheet is enqueued in the functions file. I have tried adding it the conventional way in the header:

    <!--[if lte IE 8]>
    <link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/ie.css "media="screen" type="text/css"/>

    The path shows up correctly, but I don’s see any of the style changes taking effect.

    I’ve also tried to enqueue it in the functions file:

        global $wp_styles;
        // other style sheets...
        // ie-only style sheets
        wp_register_style('ie', get_bloginfo('template_directory') . '/ie.css');
        $wp_styles->add_data('ie', 'conditional', 'lte IE 8');

    This pulls a stylesheet in the wp-admin folder! Not what I’m looking for either. I feel like I’m missing something simple. Any help appreciated!

Viewing 2 replies - 1 through 2 (of 2 total)
  • paulwpxp


    Font hero

    Use get_stylesheet_directory() instead, it’ll work regardless if in child or parent.

    Use if ( ! is_admin() ) to use it in web front only.

    Becky Davis


    WCEU 2016 Contributor

    Thanks Paul, but using stylesheet vs. template made no difference in either case.

    I believe the background image/IE8 issue may be a javascript conflict. By removing the declaration for it in the ie stylesheet altogether and adding !important to the other font size change declarations, I got it to work, so my original code in the header was correct.

    At least at this point I have something that works in IE8 and doesn’t look horrible.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘_s Underscores theme conditional stylesheet’ is closed to new replies.