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

Angelina Bethoney
Angelina Bethoney
117 Points

Linking Bootstrap CSS Files - 404 error

Hi,

I'm trying to link the bootstrap.min.css using the functions.php, but the CSS file cannot be found (404 error in my console).

This is my functions code:

"""functions: <?php function theme_styles() { wp_register_style( 'bootstrap_css', get_template_directory_uri() . '/css/bootstrap.min.css' ); wp_enqueue_style( 'bootstrap_css' ); } add_action( 'wp_enqueue_scripts', 'theme_styles' ); ?>"""

I DO have wp_head in my header file, and my files are set up the same way as the video.

Any ideas?

3 Answers

Andrew Shook
Andrew Shook
31,709 Points

Angelina, can you look in the web inspector at the src attribute for the stylesheet in the link tag. When you find it make sure the file path is correct. If the file path is correct, double check to make sure you put the bootstrap css file in the css folder.

Angelina Bethoney
Angelina Bethoney
117 Points

The style sheet is correct. However, when I click on the style sheet it says 404 Not Found. The css file is in the correct folder.

Angelina Bethoney
Angelina Bethoney
117 Points

Okay I see where the problem is, but I'm not sure how to fix it. For some reason, it's looking for these files:

""" <link rel='stylesheet' id='bootstrap_css-css' href='http://www.angelina-marie.com/wp-content/themes/twentytwelve/css/bootstrap.min.css?ver=3.9.2' type='text/css' media='all' /> <link rel='stylesheet' id='main_css-css' href='http://www.angelina-marie.com/wp-content/themes/twentytwelve/style.css?ver=3.9.2' type='text/css' media='all' />

"""

view-source:http://www.angelina-marie.com/#

lines 23& 24. These files do not exist. There isn't anything in the twentytwelve file.I even tried to deletethe twenty twelve folder, but it's still searching for it.

I'm not sure why my computer is looking for this file, and I'm ripping my hair out trying to figure out how to link it to the correct one.

Angelina Bethoney
Angelina Bethoney
117 Points

When I look at my website using the console, I see that the twentytwelve folder IS being used. I have no idea as to why or how! I deleted the twenty twelve folder! I can't figure out why my website continues to pull up that folder!