Reworking Theme Files & Organization


Theme folder and file structure

While WordPress themes technically only require two files (index.php and style.css), they usually are made up of many files and can become quickly disorganized.

In the last section, Template Files, you set up your header.php, footer.php, page.php, home.php, and single.php files.

Let’s look at  the Twenty Twelve theme default themes as one example of good file structure and organization.  While this may be a bit overwhelming at first, let’s break it down.  Can you find the templates you just built?


While there are still a lot of files, their names help provide a context of what they are.  Basically each file handles a feature of WordPress.  I.e. comments.php deals with how the theme will handle comments; image.php instructs the theme how to handle images, etc.  Don’t worry about adding these files unless you need them.

You can see that the main theme template files are in the theme’s root directory, while JavaScript, languages, CSS, and page template files are placed within their own folders.

At this time there are no required folders within a WordPress theme. However, WordPress does recognize the following folders by default:

Page templates folder


The custom page templates, named page-templates (since: 3.4.0) allows for better organization of template files. Custom page template files placed in this folder are automatically recognized by WordPress.

Language folder


If you wish to internationalize your theme so it’s usable in other languages, you can create a languages folder to contain translations.