WordPress.org

Support

Support » How-To and Troubleshooting » Default Template not linking to Stylesheet in IE 7 or 8?

Default Template not linking to Stylesheet in IE 7 or 8?

  • I’m just about done with my site, but am running into an IE compatibility issue. I know shocker right. No problems in Firefox, Opera, Safari or Chrome. Ugg…sigh.

    Anyways it appears that in IE 7 and 8 my site is not pulling my stylesheet at all. It was working before when I was developing on my subdomain, but I’ve since added some conditional code depending on what page you’re on. See below.

    <?php if( comments_open() ) :?>
    <link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/blog.css" media="screen" type="text/css" />
    <?php elseif ( is_page_template('homepage-page-template.php')  ) :?>
    <link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/home.css" media="screen" type="text/css" />
    <?php elseif ( is_page() ) :?>
    <link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/style.css" media="screen" type="text/css" />
    <?php endif;?>

    This pulls different stylesheets depending on what page you’re on. That being said I think that might be my issue. I jsut don’t know how to fix it. Any ideas?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Sorry here’s the link to the site in question –>
    http://www.antimicrobial.com

    I also added this strip of code for all versions of IE. It’s supposed to automatically pull your css which was working before, but I figured due to the multiple calls to diff stylesheets I’d give this a shot.

    It’s an absolute target as I was starting to run out of ideas as to why IE couldn’t find it.

    <!--[if IE]>
    	<link rel="stylesheet" type="text/css" href="http://antimicrobial.com/wp-content/themes/default/style.css" />
    <![endif]-->

    Try moving the colon away from the closing PHP tag in your conditional statements and see if that helps..

    Replacing this..

    :?>

    With..

    : ?>

    Hello t31os_,

    I gave that a shot. It didn’t seem to do anything.

    Ok, so what happened when adding the IE conditional statement above?

    It didn’t seem to do anything. This strip of code commented out is supposed to pull what ever css you link it to.

    esmi

    @esmi

    Forum Moderator

    If this code is being added to header.php, I’m not sure if <?php if( comments_open() ) :?> will work as it’s outside the Loop.

    Also you have errors in your IE only stylesheet – something that has been known to bring IE’s CSS parsing to a shuddering halt.

    If this code is being added to header.php, I’m not sure if <?php if( comments_open() ) :?> will work as it’s outside the Loop.

    I’m not sure I understand what you’re saying here?

    I suppose I could add a different conditional statement to the stylesheet. That one right there says that if this is a blog post page where comments are open pull the following stylesheet.

    The stylesheet in question is the same one that IE was working with before I moved the site from the subdomain. I’m sure there are some issues with it, but before I can tackle any formatting problems I need to first get the site to actually pull the stylesheet.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Default Template not linking to Stylesheet in IE 7 or 8?’ is closed to new replies.
Skip to toolbar