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

CSS not displaying when linked

I am trying to link CSS to the wordpress site, but the CSS is not displaying when I click it in the source code. Here is the link to a page so you can view the source code: http://praxart.com/testdb/news/

When you click on one of the CSS files, it doesn't display anything. It's evident because I have some CSS to be displayed and it's not showing.

Here is the code I have:

<?php
// Load the Theme CSS
function theme_styles() {

wp_enqueue_style( 'normalize', get_template_directory_uri() . '/css/normalize.css' );
wp_enqueue_style( 'grid', get_template_directory_uri() . '/css/grid.css' );
wp_enqueue_style( 'main', get_template_directory_uri() . '/style.css' );

}
add_action( 'wp_enqueue_scripts', 'theme_styles' );

?>

What am I missing here? I'm so confused - I checked everything...I think. Do I put something in the css file to get it to activate? Everytime I click the URL it's blank, and there's CSS code there, for sure.

Thanks for the help!

4 Answers

Oh! Would the fact that I placed spaces in the title of the folder have something to do with it? Ah! That was it!

No spaces in folders. Thank you, it works now! :D

Hey Ricardo!

I'm inspecting that page you linked to and it seems like the css files ARE being included, but they are 404 (not found), so when I try to open the files they are empty. the directory it's trying to find them in is themes/FloridaBrazilianJiu-JitsuFederation/. Do you have a directory in your themes directory called "FloridaBrazilianJiu-JitsuFederation"?

Patrick.

Gautam Thapar
Gautam Thapar
5,265 Points

Seems to be working fine for me.

Glad to help!