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

nicholas maddren
nicholas maddren
12,793 Points

Some Styles Pulling Onto Page, Outdated Tutorial?

Hi I have tried adding bootstrap to the functions.php file however I just cant seem to get it to work properly. I can see on my page that it is pulling through onto the page just fine but no CSS styling is being applied?

Is this tutorial outdated or am I doing something wrong?

Here is my code:

<?php


function theme_styles() {

    wp_enqueue_style('boostrap_css', get_template_directory_uri() . '/css/bootstrap-theme.min.css');
}
add_action('wp_enqueue_scripts', 'theme_styles');

?>

Here is the site that I am working on:

nickmaddren.com

Thanks, Nick

2 Answers

Ludvík Matějíček
Ludvík Matějíček
12,557 Points

Hello Nick, you need call 'core' bootstrap.css not bootstrap-theme.css.

<?php


function theme_styles() {

    wp_enqueue_style('boostrap_css', get_template_directory_uri() . '/css/bootstrap.min.css');
}
add_action('wp_enqueue_scripts', 'theme_styles');

?>

Not sure if this could be part of the problem however. You have a misspelling you have wp_enqueue_style('boostrap_css', should be wp_enqueue_style('bootstrap_css'.