5 Common Template Mistakes of WordPress Theme Development

5 Common Template Mistakes of WordPress Theme Development

 

This article assumes that you will be using the Underscores starter theme as found on GitHub from the WordPress community.

Theme development does have its gaps unless explicitly written down and seamed through on a development checklist. Even if you have a starter theme and the template hierarchy itself to ease the work in developing a WordPress website, there are still parts of it that have to be developed.

So let’s check these 5 common theme templates that WordPress theme developers may make during the theme development phase.

1. Forgetting to Develop the Index.php File

This is the blog homepage or the ‘is_home()’ template of the website.

Where you display a time-based list of blog posts for the website.

The index.php file may also be considered the default template file for all your theme files according to the WordPress Template Hierarchy.

Developing the index.php file will usually include styling up the content.php file so that you may display the list of blog posts on the index.php file properly.

Please note that the content.php file is not to be confused with the single.php file! We’ll discuss developing the single.php in a bit…

2. Forgetting to Develop the Archive.php File

This is akin to the index.php file. In fact, if you don’t have an archive.php file, it will default to the index.php file.

The archive.php file is very similar to the blog homepage template. But the difference with the archive.php file is that it specifies by the taxonomy of your WordPress posts.

This means that you could have a: Category Archive, Tag Archive, Date Archive, Author Archive, or even a Search Archive. However later on we’ll stress out the search.php file.

3. Forgetting to Develop the Single.php File

The single.php file is where your blog post content will go. You could think of this as a post.php. But since this terminology has been taken by WordPress wherein even a ‘webpage’ is considered as a ‘post’, we have to use the terminology single.php instead.

So think of every item on WordPress as a post, as defined by their ugly URL http://example.com/?p=123, where the key p means ‘post’. Who knows, this ‘postcould be a webpage!

4. Forgetting to Develop the Search.php File

The search.php file is used for search results. Usually we could have the styling copied over from your default page.php template. But output its starter contents within the same area you would find the Page template’s the_content().

It is recommended to keep your search.php file rather than deleting it, since it will be useful to output the heading e.g. ‘Search Results for: Holy Grail’.

5. Forgetting to Develop the 404.php File

The 404.php file can be considered as a simple Page template. It may contain a simple text like ’Please try using the navigation menu above. Alternatively you may Contact us.’ and include an H1 heading of ‘Page Not Found’ or something better to convey that the users have reached a dead page.

Therefore you can simply copy most of the page.php code over, but replace the Loop found in there with a ‘not found message’ for the users.

In fact, have a look at creative 404 pages from Awwwards.com for inspiring 404 pages you can emulate!


These are the common templates that are usually missed when developing a WordPress Theme. Sometimes they may seem to be a hassle however they are pertinent templates that must always be styled and developed! It goes without saying that these templates help complete your WordPress theme.

Thank you for reading!

If you liked this article you might like to find out the 100 Reasons to Learn WordPress Theme Development! Have a good day!