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

Linking CSS files in Wordpress

I want to include the Twitter Bootstrap style sheets in my WP theme.

How do I do this?

2 Answers

Jonas Robertsson
Jonas Robertsson
8,079 Points

I'm guessing you have already downloaded twitter bootstrap.

Place the files in your theme folder and add this to your header:

<link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/css/bootstrap.min.css" type="text/css" media="screen" />

Is it me or did you accidentally cut off the first part of the code? Iwhich command/tag did you use?

Is it me or did you accidentally cut off the first part of the code? Iwhich command/tag did you use?

Matt Campbell
Matt Campbell
9,767 Points

Hi Drew Gillett

No that is not how to enqueue stylesheets in WordPress.

Two options, one is to put the styles from bootstrap in styles.css.

Second option, probably preferred, is to enqueue the style via functions.php. That's the best practice way. There's also the option to @import to style.css.

Certainly, you don't just include in header like you would in a static site.

Codex has all the answers if you haven't gone through the courses here.