Using WordPress Themes can be one of the best ways to create a sophisticated, multi-purpose website. The only downside to the endless possibilities of this tool is that it can be confusing to work with at times. In order to understand how to best work with these themes, it is important to understand the different types of file templates that are used in WordPress themes in order to display your website’s information.
Essentially, it all starts with ‘index.php’ files. These are the most basic template files, and they are all you really need in order to create a WordPress theme. When you want to get more specific, that is when different types of template files come in handy.
For example, let’s say you run a food blog that highlights restaurants in a few different cities within America. If someone reading one of your blogposts is planning a trip to Los Angeles, they will click on the category ‘Los Angeles.’ With this, WordPress will go to work searching for an archive that only shows posts about Los Angeles, which would be a specific type of template file. If that doesn’t come up, WordPress will then look for an archive that has categories related to Los Angeles, such as ‘California.’ WordPress will continue to try to narrow down its search until it is only left with the ‘index.php’ file, the most basic file which may only contain a tag as specific as ‘Restaurants.’
Understanding the uses and benefits of different types of template files is a great start to understanding how to modify or even create your own WordPress Themes.