What is: Template
January 16, 2020 by Troy
In WordPress theme development, a template defines part of a web page generated by a WordPress theme.
header.php is a default template used in most WordPress themes. It defines the header area of web pages generated by WordPress. The header file will typically be loaded on every page of your WordPress site, allowing changes to be made to a single file, that will apply across the entire website.
Most WordPress themes have some default templates with code to generate HTML output for particular sections of a website.
- Main –
index.php. To display the main page of a website.
- Header –
header.php. Displays the header section.
- Sidebar –
sidebar.php. Generates HTML output for the sidebar section.
- Footer –
footer.php. Displays the footer section.
- Theme Functions –
functions.php. Contains code and functions to be used in a theme.
- Single Post –
single.php. Displays the single post page.
- Comments –
comments.php. Displays comments and comment form.
Templates can be included into each other. For example,
single.php can have header, footer, sidebar, and content template included into it. WordPress allows users to add as many as they would like. Some themes will have them for custom loops and sidebars as well.
WordPress also has a templates hierarchy. If a theme doesn’t have
single.php for some reason, then WordPress will automatically fall back to a more general templates like
Apart from these templates, each WordPress theme must have a style definition file named
This post was originally published in the wpbeginner glossary.