- Required Files
- Step 1 – Create a theme folder
- Step 2 – Create a style.css file
- Step 3 – Create an index.php file
- Step 4 – Install Your Theme
- Step 5 – Activate Your Theme
- Using Your First Theme
Required Files
The only files needed for a WordPress theme to work out of the box are an index.php
file to display your list of posts and a style.css
file to style the content.
Once you get into more advanced development territory and your themes grow in size and complexity, you’ll find it easier to break your theme into many separate files (called template files) instead. For example, most WordPress themes will also include:
- header.php
- index.php
- sidebar.php
- footer.php
Step 1 – Create a theme folder
First, create a new folder on your computer, and name it my-first-theme
. This is where all of your theme’s files will go.
Step 2 – Create a style.css file
You can use any basic text editor on your computer to create a new file called style.css.
Copy and paste the following code into your newly created style.css
file:
1 | /* |
Step 3 – Create an index.php file
Now create a file named index.php
and put it into your theme’s folder, adding the following code to it:
1 | <!DOCTYPE html> |
Step 4 – Install Your Theme
Copy your new theme into the wp-content/themes
folder on your development environment and activate it for review and testing.
Step 5 – Activate Your Theme
Now that you’ve installed your theme, go to Admin > Appearance > Themes to activate it.
Using Your First Theme
Congratulations – you’ve just made your first WordPress theme!
If you activate your new theme and view it within a browser, you should see something like this:
Okay, so it’s not the prettiest theme yet, but it’s a terrific start!