Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.