4R - WordPress Template Hierarchy System

Define/Explain template hierarchy system

WordPress uses the query string to decide which template or set of templates should be used to display the page. The query string is information that is contained in the link to each part of your website. Wordpress matches every query string to a query type to decide which page is being requested. Wordpress selects the template in the order determined by the template hierarchy and then looks for template files with specific names in the current theme's directory and uses the first matching template file specified by the hierarchy.

Define/Explain template hierarchy system - order

The order of the template hierarchy system starts off with the page template if it is assigned. If there are no custom templates, WordPress will use a specialized template that contains the page's slug. If none is found, it will look for a template with the page's ID. If none is found, WordPress will use the theme's default template. If none, it will use the theme's template used for a single post, irregardless of post type, and if no page templates are found or assigned, WordPress will automatically default to using the theme's index file.

Define/Explain template hierarchy system - file naming conventions

When naming files, folders, and directory names, you should use lowercase letters and separate words with hyphens and not underscores.
When naming custom pages, it is recommended to name your files to match the function of the theme file. It is also recommended to use an underscore for the custom page or else it could be mistaken for a specialized template.

Summary of the Documentation

In summary, the WordPress Hierarchy system is essential when you want to learn how to make quick adjustments and customizations to your site. Understanding the order will help you understand which files you will need to change when you want to customize a WordPress theme.