Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

What is: Template

In WordPress, a template provides the structure for how your content will be 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 a 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 define 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 a 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 template files. However, they may differ depending on the theme you are using.

Some templates you are 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.

Finding Templates Using FTP

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.

Finding Templates in the Full Site Editor

If you are using a new block theme, then you can edit templates using the Full Site Editor.

In block themes, templates are predefined structures that you can use to design a specific type of page on your website. For example, many block themes come with a Single Post template that defines the layout of a blog post page.

Simply navigate to Appearance » Editor and click on ‘Templates’ in the menu. Here, the Templates page lists all of the current templates and lets you create new ones.

The Templates page in WordPress Full Site Editor

When you click on one of the templates, you will see details about that specific template, its patterns, and when it was last modified.

To edit it, simply click the pencil ‘Edit’ button. This lets you edit the page template using the block editor. You can add new blocks and customize the block or page settings.

Finding Templates in the Theme File Editor

For older themes, you can edit template files by navigating to Appearance » Theme File Editor when logged in to your WordPress admin area, and in the ‘Appearance’ tab, click on the ‘Theme Editor’ link.

Once you are 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

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

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