Working with the WordPress theme template hierarchy

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 ...

Get WordPress Development Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.