logomichael sumner
Contact

5 Most Forgotten WordPress Theme Template Files, What to Do About Them

WordPress comes with a whole bunch of functionality when it comes to themes that make it easier to identify what template to use based on a given post or page. You can have a look at the WordPress Template Hierarchy to find out more about the full list of templates available for WordPress themes.

A WordPress starter theme like the Underscores starter theme comes with a good amount of template files. Albeit this is a starter theme so it is not mandatory for you to use all the files within there. You can even delete some of them and let them inherit parent templates as found in the Template Hierarchy.

5. Single.php

This template file is used in outputting the blog single posts. The Underscores theme defaults with it displaying as an article HTML element, which a header and footer. The Header includes the Heading 1, and the Footer contains an editor’s Edit link.

What can be done though if you would like is to remove the footer link if it might not be necessary for your case. Although it makes no trouble to have it kept on there.

However, the article element is well-utilised to signify a portion of content on the page to be portrayed on a Reader’s Mode, e.g. on the Safari browser.

5 Most Forgotten WordPress Theme Template Files, What to Do About Them
Be careful on which planet you visit!

4. 404.php

For your 404 page, you will want to make sure that you style up your 404 page. It may be common to miss out because you don’t always hear a designer want to send you across a 404 design template. But as always, a 404 page is a great opportunity to leverage. Towards the end of the article it summarises the main reason why a 404 page must always be customised to be more unique than having an ‘error 404 page’ text displayed:

“Little things done right actually matter and well designed moments build brands,” Gleeson said. “A simple mistake can tell me what you’re not, or it can remind me why I should love you.”

— Renny Gleeson, from his 404 Ted Talk

Make sure that you request a certain design for a 404 template. If not, inform your designer about the opportunities that a 404 page can bring by having one designed. It’s about these small little details like having a 404 page styled which can immediately set a website apart from the rest of its competitors, because it has that lil’ bit o chic.

3. Index.php

The blog index page, and also the most generic of all templates. However not all custom built WordPress themes might take into consideration having one unless the client will require a blogging platform. Yet, WordPress the most popular CMS in the world, not to be styled with a blog? That’s bonkers.

What it takes to craft a Blog Index page would be the elements within the loop of that page, like a list of the latest blog posts in a grid layout, with a link to each one using the_permalink. And recall the single.php we almost forgot earlier? Yes that has to be styled too!

The index.php in website terms is the ‘default’ file of the folder. In this case, it is the default theme file that gets read first. You might’ve heard of using index.html for your homepage in using Notepad at school? Well this is the page, only differing by file extension as .php.

Therefore it is a must-have for the most default of all theme files to be styled. Regardless of having a blog template or not.

2. Archive.php

Yes, this is one of the first files in this article that you can delete. In most cases it is similar to the index.php, since it is a list of articles of its category sorted in descending chronological order.

Having a look back at the Template hierarchy you will find out that you may or may not want to keep this archive.php file. However, I have experienced that this was not necessary to keep, since most of the time you will have your category archive pages equal in layout and similar in output as the index.php file. For example, where you have a main looping through a display of the latest posts for that category (if it were the index.php it would be all categories), and possibly an aside (sidebar) that would have widgets like a tag cloud for the current category (or of all categories).

So I would recommend removing the archive.php, but keeping in mind that you might not want to always remove this if you might want to have a different layout compared to the default index.php layout.

5 Most Forgotten WordPress Theme Template Files, What to Do About Them
What template did I forget to customise?

1. Search.php

The most forgotten template from what I have experienced across different developers’ custom theme templates. Forgotten not for it being deleted, but for it being left out completely because it didn’t seem like it was made sure what to do with it!

Looking back at the Template hierarchy, the search.php file will display itself as completely separate from being an archive of its own. Yes, it can seem like an archive, but it is surprisingly not. Instead, it is a results list based on a particular search. Think of an archive as ‘already being there, ready for you to peruse’, and a search as ‘actively seeking within archive/s’. Got something in common, but not enough for it to be coupled.

So what to do with a search.php file? You will want to copy across the layout and styling of your archive.php file or your index.php file, and set a place for the search form, and search results text.


If you liked this article you may want to save for future reading the article about Why to Partialise WordPress Theme Template Files.

Please let me know in the comments below how you think?