In general, a template is a pre-designed resource that can be customized or modified to suit your needs. Instead of having to always design everything from scratch, using a template allows you to start with a functioning resource and then tailor it to see your needs.
In WordPress, templates are used for themes. When you install WordPress, it automatically comes with several templates. The template determines the overall layout and look of your website such as how posts, pages, and other things like widgets will be displayed.
Because WordPress is coded using the PHP programming language, all WordPress theme templates are PHP files that use the “.php” extension. For example, your WordPress theme probably has a file called “index.php.” This is the file that determines how the main page of your website will be displayed. Likewise, a “header.php” file determines how the header section of your website will be displayed.
Template files can also be folded into one master file that contains all of the different templates used by your website. For instance, you may want to use a unique template for special sections like a sidebar or footer section. When designing a template file, you can include as many or as few templates as you want.
If you’re confident about what you’re doing, you can modify the way that different sections appear on your site by changing these template files. It is highly recommended that you first make a backup copy in case something goes wrong as the template files must be formatted in a very specific way.
Note: Every WordPress theme template must be accompanied by a separate file that defines styles. This file must be named “style.css.”