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! While you're at it, check out some resources Treehouse students have shared here.

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

WordPress

Rc Cnls2
Rc Cnls2
1,178 Points

can'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

Hi,

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

Rc Cnls2
Rc Cnls2
1,178 Points

Yes 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?

Do 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

Ian Holden
Ian Holden
8,556 Points

Without 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');