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 From Bootstrap to WordPress Setup a Bootstrap Theme Add Bootstrap CSS via the functions.php File

Daniel Hughes
Daniel Hughes
2,854 Points

When Adding Bootstrap CSS via the functions.php File I get a server error. What am I doing wrong?

The other themes work just fine so I know its not wordpress or my local server. Here is my code:

FUNCTIONS.PHP <?php

function theme_styles() {

    wp_enqueue_style( 
        'bootstrap_css', 
        get_template_directory_uri() . '/css/bootstrap.min.css' 
    );

}

add_action( 'wp_enqueue_scripts', 'theme_styles' );

?>

HEADER.PHP <? php wp_head(); ?>

Thanks

Sue Dough
Sue Dough
35,800 Points

Can you try being specific about the error?

5 Answers

The code looks correct to me. Maybe double check your css folder and make sure that bootstrap.min.css is actually in there.

Daniel Hughes
Daniel Hughes
2,854 Points

Not much to be more specific. It takes me to a blank white screen that just says "server error"

Daniel Hughes
Daniel Hughes
2,854 Points

I will check on the folder structure thanks

Has Wordpress loaded correctly in the past? It sounds like it's not now. I'd check and make sure both Apache and MySQL are running.

Malte Niepel
Malte Niepel
19,212 Points

I have the same problem and can't find a fix for it. Did you find the answer Daniel Hughes?