Support » Themes and Templates » Conditional Stylesheet for Starkers.

  • Hi there.
    I’m creating a theme in Starkers. All is going well so far, but I need to use a conditional stylesheet. Usually this works fine by puting something like this:

    <!–[if IE 7]>
    <link rel=”stylesheet” src=”<?php bloginfo(‘template_directory’); ?>/style_ie7.css” type=”text/css” meia=”screen />
    <![endif]–>

    However, it is not working on the newest version of Starkers. I’ve noticed that it there is no reference to the stylesheet in the header, well not directly, it sends it to the functions php:

    <link rel=”shortcut icon” href=”<?php echo get_stylesheet_directory_uri(); ?>/img/favicon.ico”/>

    In here there is a link to the CSS.

    function script_enqueuer() {
    wp_register_script( ‘site’, get_template_directory_uri().’/js/site.js’, array( ‘jquery’ ) );
    wp_enqueue_script( ‘site’ );

    wp_register_style( ‘screen’, get_template_directory_uri().’/style.css’, ”, ”, ‘screen’ );
    wp_enqueue_style( ‘screen’ );
    }

    Would the conditional sheet go here?
    If so does anyone know what the code should should be.

    Thanks in advance.

Viewing 1 replies (of 1 total)
  • Hi Mad_vlad.

    I am a total noob when it comes to wordpress and i was having quite a struggle including even just stylesheets.

    i finally figured how to do it and yes, your right, that it seems to get included in the functions.php.
    However the line where you say

    However, it is not working on the newest version of Starkers. I’ve noticed that it there is no reference to the stylesheet in the header, well not directly, it sends it to the functions php:

    <link rel=”shortcut icon” href=”<?php echo get_stylesheet_directory_uri(); ?>/img/favicon.ico”/>

    is not correct and that has nothing to do with the stylesheets. Thats just for getting the favourites icon working on the site. You would drop the icon file in the /css/img folder for that.

    With regards to the style sheets I found this handy link which helped me loads.

    So my stylesheets eventually looked like this:

    wp_register_style( 'all', get_template_directory_uri().'/style.css', '', '', 'all' );
    wp_register_style( 'desktop', get_template_directory_uri().'/css/desktop.css', '', '', 'all' );
    wp_enqueue_style( 'all' );
    wp_enqueue_style( 'desktop' );

    It probably could be better, but i dont know.

    What they do mention though is that conditional stylesheets seem to go in the head as they always used to.
    They say

    …you need to add a few conditional statements. These should go in your header.php file before the closing head tag…

    <!--[if lt IE 9]>
    <link rel="stylesheet" href="/css/ie.css">
    <![endif]-->

    I know this doesn’t answer your question exactly but maybe you can find it from there and let me know if you do. I’m pulling my hair out trying to find an answer!!

    Cheers

Viewing 1 replies (of 1 total)
  • The topic ‘Conditional Stylesheet for Starkers.’ is closed to new replies.