Must have files for a WordPress Theme – (Part 1)

What You’ll Learn

Required files for any WordPress Theme, and the Standard Pages for a Theme that you should have.

Required Files

By default your theme MUST posses those files:

  1. style.css
  2. index.php

If you don’t have them, you won’t be able to activate the theme and make it work.

I will explain what are those files later in this article.

Standard Pages for a Theme


The header file is self-explanatory. You will want to put there what will repeat on every single page. So that is the <head></head> and what’s inside. You want to grab all of the header block code. So it should start from the doctype.

You can include the header in two ways.

The standard one is:


There is also another way, where you can add hooks to the header, the code:



The footer is similar to the header, it follows the same logic. However, in the footer, you will want to put in the code that the footer has.

To get the footer, you need to:


The footer needs to include the hook, just before the closing body tag.



The sidebar file is where you would normally put your widgets, your latest posts, popular content, subscribe and so on.

The sidebar is also a common place to put in ads, as the sidebar might display on every single page.

To get the sidebar we use:



The index file is the default file of WordPress. If there are no files found, WordPress will go and look for the index.

This is going to be used as a blog. However, the index file itself will be blank. Remember the file’s header and footer? You can also get the sidebar in. We need to include those on every single page – the header and footer. The sidebar is up to you.


<?php get_header() ?>

// Optional
<?php get_sidebar() ?>

<?php get_footer(); ?>


On the index page, you should have displayed your blog posts. The user enters, and see many ‘excerpts’ of blog posts. If he/she is interested in one of them, they click to read it all. Here is where the single.php file comes in.

Here you would display the title, the image and the full content. You can also display a sidebar like on this blog.


You might wonder, how do we style the single page? Well, you can style it on its own, or you can use a page.php file.

If you have, say  these pages: “About Page”, “Contact Page”, “Resources Page” – and they have no template or no way to look, they will take the page.php file and use that.

The page.php is a default or fallback just in case a page doesn’t have anything to take. You should definitelly use the page.php file if you’re making a blog.


The functions file is a fun one. You can put any script you want for your theme. Custom functions that can be called in the WordPress blog pages.

A common thing to do in the functions, if not a MUST thing to do, is to take the CSS and JavaScript and connect them to the theme.

This is a dynamic way of adding the assets to the theme. You can do that with wp_enqueue or any other possible way that’s out there.


The infamous or perhaps famous 404 page. Oh! That broke link. Oh! Content not found.

Do you remember when you were looking for something, or perhaps reading an article that forwards you to a different page and you get a 404, content not found, or no page exist? Yes! This is it.

A 404 error is when a page coudn’t be find be the request – it’s mostly because the page is no longer there, or someone is trying to put access a link with a blog post that doesn’t exist. In this page, add a / and after that type some random letter, you will see a 404 page.


This file is a MUST. Without this file you won’t be able to do anything that’s above. It needs to be set up properly. In the admin section, to identify the theme. You must put a comment that says the theme name, the theme url, description, author, version and tags. There are many more you can put, but these are the basic you need.

Theme Name: Aurelian WP Basic Starting Theme
Theme URI:
Description: Must have WordPress files, basic starting them.
Author: Aurelian
Version: 1.0 
Tags: theme, basic, template


These are just the standard, basic theme files. If you want to get fancier with it, there are more to come, such as taxonomy, front-page, author and much more. I’ll cover them in the next article.

For now, Happy Coding, and see you, in the next article! 🙂

Meet the author

Meet the author

Aurelian Spodarec

Front-end WordPress developer that blogs about web development. I like using the right tools for the job. In my spare time, I enjoy cooking healthy food and then eating it. Delicious!