Template Hierarchy System

The Template System

WordPress' template hierarchy system is meant to allow for custom templates to be used for certain applications instead of the base 'page.php' or 'index.php' file. These templates are meant to add some variety to the overall structure of the site. Without templates every page and post ends up looking the same and can be pretty bland as well as confusing if only certain pages require certain parts of the file.

Template Order

The template order exists to allow custom templates to be applied over others. If a template is high in the order relative to others in the same category then it will be used over those and so on.

File Naming Conventions

The naming conventions for templates are mainly the type of page that it's being applied to (so page-[$slug].php or single-[$posttype].php for examples) or the specific type of template it's supposed to be (page_full-width.php; the underscore '_' meant to separate the name of the template).

Summary

The hierarchy serves an important purpose for site customization. Understanding the hierarchy allows developers to apply certain templates to specific pages, whether by id, slug, category, author, and more. While not every post or page may find a custom template useful, it's certainly not bad to have ideas up your sleeve.