WordPress WordPress Theme Development Working with CSS and JS in WordPress Themes Adding CSS to a Theme Via the functions.php File

shareyourpeace
shareyourpeace
3,244 Points

At time. 5:20. Normal_css is used for 2 wp_enqueue statements. Why ?

Wp_enqueue_style uses the same name 2x. Normalize_css is used for both Normalize.css and also the google fonts link copied from @import.

Question. Why are two of these enqueue statements allowed to use the same 'name' ?

Thanks

shareyourpeace
shareyourpeace
3,244 Points

resolved. Zac will point out in the next chapter about Loops that these names need to be differentiated.

2 Answers

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

Yup, as you saw, just a mistake that gets corrected when we circle back to the CSS once it's loading in the header :)

shareyourpeace
shareyourpeace
3,244 Points

Zac.
With the reformatting and upgrading of this course (which I started from the beginning again), I believe that you missed including in this update, what is reference as 'circling around' to correct the above error in the code.

I looked in the downloaded projects folder, at the final functions.php.

    wp_enqueue_style( 'foundation_css', get_template_directory_uri() . '/css/foundation.css' );
    //wp_enqueue_style( 'normalize_css', get_template_directory_uri() . '/css/normalize.css' );
    wp_enqueue_style( 'googlefont_css', 'http://fonts.googleapis.com/css?family=Asap:400,700,400italic,700italic' );
    wp_enqueue_style( 'main_css', get_template_directory_uri() . '/style.css' );
Bob Sutherton
Bob Sutherton
20,160 Points

Yeah, I got hung up here too. I was trying to load a google font into my own site and it wasn't working. When I saw this and changed the name of the file it started working. I had started to give it its own name but when Zac named it the same I followed suit. Haha!