A WordPress theme can be built with just three files: style.css, index.php, and comments.php. However, the complete template hierarchy can support quite a large number of sub-templates, flexible enough to cater for the advanced requirements of many sites. More often than not, developers will be working on less than ten files in this hierarchy. However, the knowledge of the complete template hierarchy may come handy in projects with advanced requirements. Let's take a look at the following diagram, which consists of the types of pages used in WordPress to handle the initial request:
There are six paths to handle the user request based on the loaded content. Archive Page and Singular Page are the most complex yet flexible among these, and have a tall structure. Let's identify the main purpose of each of these pages before...