Bummer! This is just a preview. You need to be signed in with a Treehouse account to view the entire video.
The Main Stylesheet1:52 with Zac Gordon
The main CSS file for a theme contains the styles for the theme and its metadata like who created it, what version it is, and where to find the theme online. In this video we'll talk about the importance of the style.css naming convention as well as how to add theme metadata to our main stylesheet.
For project files please refer to the first video: Reviewing the HTML Prototype
WordPress Codex Reference
You can read more about the main WordPress style.css stylesheet and the comments used in this video on the WordPress Codex.
WordPress requires the main stylesheet for a theme
to have the name style.css.
At the top of this style.css file we have to enter in a specially formatted CSS comment
that includes information about our theme.
Here, for example, is what this theme looks like for the WordPress 2012 theme.
Let's go ahead and create our own style.css file in our theme directory
and enter in the information about the theme that we're building.
Let's go ahead and create a new file and save it as style.css.
It's important that we name the file correctly
because if we name this file incorrectly, our theme will not work.
Now that we have our theme created,
let's go ahead and paste in the comment metadata for our theme
that you can find from the project downloads.
We can see here that we have quite a lot of information about our theme,
starting with the name of our theme, the URL to find our theme,
a description of our theme, the author, the link to find more information about the author,
the version of the theme that we're working with, tags for our theme,
as well as information about the licensing.
Finally, we can have a more in-depth description of the theme below that.
Now that we have all of the meta information about our theme,
when we activate our theme in WordPress it should work and load properly.
You need to sign up for Treehouse in order to download course files.Sign up