I am new to wordpress, I am trying to develop a theme on localhost, I am trying to load style.css using this code in functions.php

function add_theme_scripts() {
 wp_enqueue_style( 'style', get_stylesheet_uri() );
 add_action( 'wp_enqueue_scripts', 'add_theme_scripts' );

And style.css is


But this code is not working

Can someone explain what i am doing wrong here ?

3 Answers 3


Are you sure you theme is active?

If you see your style.css code it should not have only the CSS code but also the Theme defination at header of your style.css.

Please make sure if your theme is active.

The above code for loading CSS file looks good and should work if your theme is active.

Update :

Have you added wp_head() and wp_footer() in header.php and footer.php respectively?

wp_head() should be added before </head> tag in your HTML and wp_footer() should be added before </body> tag in HTML.

  • It does have theme defination and theme is active , but still not working, what to do ?
    – beginner
    Mar 15, 2017 at 11:13
  • Please check the updated answer
    – Aftab
    Mar 15, 2017 at 11:17
  • 1
    Hey I just add wp_header() and wp_footer() , Now it is working, Thanks !
    – beginner
    Mar 15, 2017 at 11:50

Style.css is added by default when you make your theme. Why you want to add it through functions.php? You can also call any css in header.php also.


Added wp_head() and wp_footer() in header.php and footer.php file and make sure make file functions.php to add your files using this two function wp_enqueue_style and wp_enqueue_script

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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