- Day 1: Introduction, the fundamentals of WordPress theme development
- Day 2: The index.php and style.css files: the most important parts of any theme.
- Day 3: The header.php, sidebar.php and footer.php files.
- Day 4: The single.php file: the file that handles posts.
- Day 5: The archive.php, home.php and functions.php files and a wrap up of all that has gone on. You will also be able to download the whole series as an eBook.
After the excitement of learning about template files yesterday, it’s time to move and look at the most important files of all WordPress themes: the index.php and style.css files.
First off, the style.css. This is our stylesheet. As I said yesterday, this isn’t a design series, so I’m not going to dwell on it too much, but there are some important parts of a stylesheet which WordPress needs that tell it some info about the theme. The theme we’ll be creating this week is called Champion (download above). It’s based on the Default WordPress theme for ease of use. Download the theme and unzip it. Open up the style.css file and you’ll see something like this:
/*
Theme Name: Chamption Theme URI: https://wpshout.com
Description: description
Author: Alex Denning
Author URI: https://wpshout.com
Version: 1.0
*/
And that’s all you need to make a stylesheet WordPress-ified. Moving on, the index.php file:
WordPress has something called a file hierarchy which means it will look for a file specific to the page first, but if it can’t find it then it will use the index.php file. For example, posts have a hierarchy like so:
Thanks for putting together this series. Much appreciated. I’m running WP 2.8.5 locally. When I preview the Champion Theme before I activate it, I’m getting an error on line 96 of index.php. Any ideas?
I’ll take a look.
I think you mean “pedant” not pedantic 🙂
Nope. I meant pedantic.