WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] [Theme: TwentyTwelve] Won't get the right ie.css file (9 posts)

  1. Casyi
    Member
    Posted 10 months ago #

    Hello WordPress users,

    I have been trying to fix this for weeks. I'm having a headache because I just don't know what is going on and there is nothing I can find on Google.

    I'm trying to fix this site: http://www.dvadelft.nl/ for IE7 and IE8 but for that to happen I need the site to get the RIGHT ie.css file.

    This site is built with the TwentyTwelve theme (I edited everything).

    For some reason it just won't get my edited ie.css file which is located in /css/ie.css. It keeps getting a (cached??) ie.css.

    It works when I edit it locally (localhost). I even reuploaded the whole site. Cleared my cache, restarted computer. Called my host. They told me to contact WordPress.

    I tried this but it won't work:
    http://www.fix-css.com/2012/12/remove-ie-css-of-parent-twenty-twelve-theme-and-add-a-copy-of-it-in-your-child-theme/

    Please help me out because this site just won't view right in IE7 and 8. It works in all other browsers though.

    Thanks in advance.

  2. paulwpxp
    Font hero
    Posted 10 months ago #

    This is what I use.

    /**
     * Remove twentytwelve-ie css must use priority greater than 10
     * Childtheme's version of ie.css put in childtheme's css folder
     */
    function mytheme_dequeue_styles() {
    	wp_dequeue_style( 'twentytwelve-ie' );
    }
    add_action( 'wp_enqueue_scripts', 'mytheme_dequeue_styles', 11 );
    
    function mytheme_equeue_styles() {
    	global $wp_styles;
    	wp_enqueue_style( 'mytheme-ie', get_stylesheet_directory_uri() . '/css/ie.css', array( 'twentytwelve-style' ), '1.0' );
    	$wp_styles->add_data( 'mytheme-ie', 'conditional', 'lt IE 9' );
    }
    add_action( 'wp_enqueue_scripts', 'mytheme_equeue_styles', 11 );

    Depending on the amount of CSS you needs to override, if it's not much, you could use .ie class instead of switching the whole new file.

  3. Casyi
    Member
    Posted 10 months ago #

    Thank you for your reply.

    But what do you mean by that exactly? I'm still getting a different stylesheet when adding that to my functions.php or should i change every "mytheme-ie" to my own theme name?

  4. paulwpxp
    Font hero
    Posted 10 months ago #

    No, it could be used as is.

    Just make sure that you have a file named ie.css inside a folder named css in your child theme's folder.

  5. Casyi
    Member
    Posted 10 months ago #

    Ok, thank you. I'm kind of new to wordpress developing and I didn't make a child theme but I just edited twentytwelve and changed it to a different theme name. I think that's the reason this function doesn't work.. Do you have any other ideas?

  6. Casyi
    Member
    Posted 10 months ago #

    When I look into the source of the site in IE8 I get this:

    <link id="twentytwelve-ie-css" href="http://www.dvadelft.nl/wp-content/themes/aspiringdev/css/ie.css?ver=20121010" rel="stylesheet" type="text/css" media="all"/>

    It shows a version number behind the ie.css. Could that be the problem? It doesn't seem to get my most recent version of the ie.css. It keeps getting an old one. Everytime I make changes in that ie.css file, it won't show?

  7. paulwpxp
    Font hero
    Posted 10 months ago #

    I'm kind of new to wordpress developing and I didn't make a child theme but I just edited twentytwelve and changed it to a different theme name

    That's my fault, I didn't read the OP clearly. The code I provided is meant to be used in child theme's function.

    So this is a case of custom theme, it's different story.

    It shows a version number behind the ie.css. Could that be the problem? It doesn't seem to get my most recent version of the ie.css.

    When I directly loaded that css without the ?ver=20121010, and compared to the one with, files match. So that is not the problem.

    Do you have some kind of caching server side ?

  8. Casyi
    Member
    Posted 10 months ago #

    I don't know. I've asked the host but they told me to ask WordPress..

    I actually uploaded a modified ie.css with FTP in the right folder. But when I load that css in the browser it's unchanged. I even added a big HELLO ASDF but it won't show? Even though I really uploaded it in the same and right path.

    Any ideas?

  9. Casyi
    Member
    Posted 9 months ago #

    It's fixed!

Reply

You must log in to post.

About this Topic