WordPress Template Hierarchy System

Explain WordPress Template Hierarchy System

The WordPress Template Hierarchy System is designed so that a user may develop a system of templates that may be used. Word Press will run a query to search and decide which template will be used. The query will run based off of the hierarchy system. The template will be picked based on this order from most specific to least specific. This system allows more customization by the user.

Explain WordPress Template Hierarchy System -order

The hierarchy systerm is designed in order of most specific to least specific. The least specific template is the index.php. This is the default template if there are no other more specific templates specified. The next set of less specific templates might be page.php or single.php. These would then be applied across all pages or posts. Getting more specific would then be to create a custom php. This could then be applied to an individual page or group of pages as specified. More specific yet would be a specialized template. This is assigned specifically to an individual page based on its slug.

Explain WordPress Template Hierarchy System -file naming conventions

The template files are names according to type and then differentiated further by category or by slug. For example the least specific is index.php. There is no type or category. Next would be a template by type, such as a page or post. In this case the file name would be page.php or single.php. Next would be the custom template which adds a category to the type with an underscore. So, a custom template might be page_full-width.php. Finally, a specialized theme that is applied to a single page will use the type and add the specific slug for the page with a hyphen. For example this would look like page-about.php.

Summary

The Template Hierarchy System is a way of organizing themes and applying them to posts and pages as specified. This system allows for more customization and greater control over the appearance of the site. It also gives the developer control over who can have access to the customization. For example, admin may wish to delegate control to content creators and thus create custom theme files content creators can choose from as they are building their pages. But then, conversely, the developer may choose specific pages that the theme is specifically controlled by the file.

Web CMD Home