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 How to Build a WordPress Theme WordPress Theme Templates The Main Stylesheet

Brittany Cerra
Brittany Cerra
7,424 Points

Wordpress requirement for theme info to be written into a comment on the style.css file.

Why does Wordpress require commented out information on a theme? Where can I find the format for this comment outside of our project files?

2 Answers

jason taylor
jason taylor
2,455 Points

Hey Brittany, Im not 100% sure I understand your question, but I think youre asking why WordPress requires comments at the top of the CSS file? WordPress looks at certain comments at the top of the document to determine the name and author of the theme etc. etc. You can read about it here: http://make.wordpress.org/docs/theme-developer-handbook/advanced-theme-topics/child-themes/#2-create-your-stylesheet-style-css

Brittany Cerra
Brittany Cerra
7,424 Points

Thanks!

How is that information used within Wordpress?

The link you provided says the reason for the comment is to identify a child theme of a particular parent. I haven't learned about that yet...what if the style sheet is for a parent theme? Does the file still need that comment?

jason taylor
jason taylor
2,455 Points

It's the same in the regular themes as well. When you are in the Admin panel selecting a theme you will see information about the theme, author, web address etc. WordPress is pulling that information from the top of the CSS file.