Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial

Rc Cnls2
1,178 Pointscan't load css in Building a WordPress Theme with Foundation 5 workshop!
My css wont load even though I typed everything correctly and follow the steps carefully.
Here is what on my functions.php
<?php
function foundation_styles() {
wp_enqueue_style( 'foundation', get_template_directory_uri().'/css/foundation.min.css');
}
add_action( 'wp_enqueue_scripts', 'foundation_styles');
?>
my css files are in the css subfolder
added <?php wp_head(); ?> in header.php
but my css still wont load! please help
2 Answers

Rich Bagley
25,868 PointsHi,
I can't spot anything obvious in the code.
Is the name of the foundation file foundation.min.css or foundation.css? The only reason I ask is that I've experienced that before.
It might seem obvious but have you right clicked on the page in the browser and viewed the source to double check that it's not loading?
-Rich

Ian Holden
8,556 PointsWithout seeing your generated paths in the browser, this is just a guess for you to try...
Try removing one of the early slashes like so: wp_enqueue_style( 'foundation', get_template_directory_uri().'css/foundation.min.css');
Rc Cnls2
1,178 PointsRc Cnls2
1,178 PointsYes I've proofread everything many times still doesn't work.
I am using XAMPP localhost by the way and this is the path to the CSS folder C:\xampp\htdocs\wordpress\wp-content\themes\foundation\css
maybe get_template_directory_uri() wont get to the correct path location?
Rich Bagley
25,868 PointsRich Bagley
25,868 PointsDo you have another style sheet or just that one?
If you have another one (style.css), can you post the top section with all the Meta information please?
-Rich