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

CSS

Creating a single stylesheet for multiple pages??

Can anyone offer suggestions on how to alter my CSS to create a new "single post" page? I'm trying to convert to Wordpress and want to maintain a single stylesheet.

Code below, but w/ broken images. http://codepen.io/tpicks/pen/lryaF

Thanks! Any questions please ask.

5 Answers

Chase Lee
Chase Lee
29,275 Points

Do you know about external style sheets?

samiff
samiff
31,206 Points

Could you be a bit more specific? You can definitely use just one style-sheet for your entire theme. When you make your single.php file that defines how to generate your single post pages, just to be sure to add appropriate CSS classes so that you can target them from your style-sheet.

The WordPress Codex Theme Development page is a good starting point. Have you taken a look?

Sam,

I've made my homepage, but the CSS/HTML layout isn't ideal for a "post" page. So i'm thinking of just adding CSS to the same stylesheet but with different article classes for the single post page.

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

Tom, you can load CSS conditionally via the functions.php. This way you can say if the page is using a certain template then display a certain CSS file.

Try checking out our Linking to CSS video along with some of the WordPress conditional tags that you can use.