Beginner's Guide for WordPress / Start your WordPress Blog in minutes

What is: Template

In WordPress, a template provides the structure for how your content is displayed. It’s a file generated by your WordPress theme that can be applied to specific posts or pages to control the way they look on your website.

Templates vary from theme to theme. Some themes provide a wide range of templates and make it easy to customize them, while others don’t.

The easiest way to create new templates and customize them is by using a theme builder. These allow you to easily modify your templates using a drag and drop page builder.

What Is a Template in WordPress?

What’s the Difference Between a WordPress Theme and Template?

Understanding the difference between a template and a WordPress theme can be confusing for beginners.

A WordPress theme controls the overall appearance of your website. A theme is made up of a group of files, and some of these are template files. Themes can be installed from the official WordPress theme directory or downloaded from third-party theme designers.

A WordPress template is a single file found within a WordPress theme. It determines the layout of a single page or group of pages within a theme.

What Is a WordPress Template?

Templates are files containing HTML and CSS code that defines how content is displayed on WordPress posts and pages, as well as other areas of your WordPress website. They are designed to work within a certain WordPress theme.

It’s helpful to think of templates as page layout files found within an available theme. For example, a template file can control the way your home page looks, and determine whether it looks different from other pages on your WordPress website.

Most WordPress themes include some standard WordPress templates files. However, they may differ depending on the theme you’re using.

Some templates you’re likely to see within a WordPress theme folder are:

  • The main template (index.php) displays the main page of a website.
  • The header template (header.php) displays the header section.
  • The sidebar template (sidebar.php) generates HTML output for the sidebar.
  • The footer template (footer.php) displays the footer section.
  • Theme Functions (functions.php) contains code and functions used by the theme.
  • The single post template (single.php) displays single posts and pages.
  • The comments template (comments.php) displays comments and comment forms.

In addition to templates, every WordPress theme uses a style.css file to define the style to be used within the template.

What Do WordPress Templates Do?

Every page on your WordPress website requires a specific type of template file that defines its distinctive features. For example, a theme can have a separate template for pages, posts, news updates, calendars, media files, and more.

This means that a page template can be applied to a single post, a page section, or a class of pages. Page templates are often written for a specific page or group of pages.

For example, while the page template page.php determines the layout for all pages, the 404 page template 404.php is more specific, and will only modify a page with the slug of ‘404’.

404 Page Template

Besides using the standard templates, some themes have templates created to deliver unique design features, custom loops, and special sidebars as well.

For example, your theme may have a special template for a contact page making it display across the full width of the page, without a sidebar or footer. Or it may have a template that allows you to display any post full width.

Choosing a Page Template

Just remember that special templates aren’t supported in all themes. If your theme does include them, then they’ll be listed in the ‘Template’ panel or ‘Page Attributes’ box just to the right of your page content.

The WordPress Template Hierarchy and Template Tags

The templates in WordPress work in a hierarchy. This means that if a theme doesn’t have a certain template, then WordPress will automatically move up the hierarchy and use a more general template.

For example, if your theme doesn’t have a front page template, then it can use another template such as index.php instead.

The WordPress Template Hierarchy

You can view many more template infographics in our beginner’s guide to the WordPress template hierarchy.

One template can be included inside another template so that they work together. This is achieved using template tags. For example, you could have a single page template that includes a header, footer, sidebar, and content template.

How Do You Find Templates in WordPress?

Templates are files stored on the server of your WordPress hosting provider. If you wish to edit your templates, then you will need to know how to access them.

One way to find your theme’s templates is by using an FTP client like FileZilla. You need to locate the /wp-content/themes folder and then find your theme folder.

Using an FTP Client to Locate Your Theme Templates

Inside that folder, you will find your theme’s template files along with other files. You can edit those files by downloading them to your computer and using a text editor.

The other way you can access your template files is by navigating to Appearance » Theme File Editor when logged in to your WordPress admin area and under the ‘Appearance’ tab click on the ‘Theme Editor’ link.

Once you’re there look for the template files available within the active theme on the right side of the screen.

The WordPress Theme File Editor

The text box in the center of the screen lets you edit the contents of your template files.

Where Do You Find Templates With a Theme Builder Plugin?

The easiest way to customize your theme templates is by using a theme builder plugin. SeedProd is the best WordPress theme builder plugin. It lets you create beautiful website layouts and even create a custom theme without writing any code.

You can learn how to easily create a theme with SeedProd using our guide on how to easily create a custom WordPress theme without any code.

Once you’ve done that, you can find and customize your templates by navigating to SeedProd » Theme Builder.

Templates in the SeedProd Theme Builder

When you click on any template, you will open your post template in SeedProd’s visual editor.

This has a 2 column layout that lets you add new blocks and sections to the template while seeing a preview in real time. You can change the settings for any block simply by clicking it.

SeedProd Visual Editor Blocks and Sections

We hope this article helped you learn more about a WordPress Template. You may also want to see our Additional Reading list of related articles for useful WordPress tips, tricks, and ideas.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Additional Reading

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!