Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I got a pretty basic theme and just found out my style.css file doesn't get loaded into the <head>. I already searched around but can't find out, why it's not loading.

I inspected the global $wp_styles object already but couldn't find anything:

function style_test() 
{ 
    $wp_styles = new WP_Styles();

    echo '<pre>'; 
        // $wp_styles->enqueue == completely empty
        print_r( $wp_styles->registered ); 
    echo '</pre>'; 
} 
add_action( 'wp_print_scripts', 'style_test', 0 );

Inside the object i also can't find my registered/enqueued stylesheets (they get loaded), so i guess i'm doing something wrong on inspecting this too. Any ideas?

Note:
If i enqueue it manually, my style.css file get's loaded. Just the automatic loading doesn't work. Further more i can access the file with get_theme_data( TEMPLATEPATH.'/style.css' ); without a problem.

share|improve this question

1 Answer 1

up vote 7 down vote accepted

Theme stylesheets aren't usually enqueued, they're normally loaded using..

<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />

So naturally you don't see them(it) in the styles array..

You can of course(if you prefer) use an enqueue instead.

share|improve this answer
3  
The primary stylesheet style.css - just like any other stylesheet, for that matter - must be either hard-coded into the document head, or else manually hooked into wp_head or wp_print_styles. WordPress does not automatically hook style.css. –  Chip Bennett Apr 13 '11 at 14:50
    
I (until now) thought that loading style.css happens auomagically... thanks for clarifying! +1 both. –  kaiser Apr 13 '11 at 15:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.