Design Your Site

Templates

A template controls the layout of your pages. Not to be confused with Themes (that set the design of your entire site), the template affects the look and feel of an individual page (or post) or groups of pages (or posts.)

This guide explains how to change a page’s template and edit it on specific themes.

Table of Contents

Templates

If your theme includes templates, you will see a Template section in the editor sidebar under Page Settings, as shown in the image on the right.

The template controls how the page is displayed. Common templates include:

  • Default template: the standard template.
  • Full-width template: this template shows the page content across the full width of the screen, without any sidebar.
  • Grid template: this template displays content in a grid layout (see this example from the Dara theme.)

Changing a page’s template affects that page only (not your entire site.)

The Page Template options in the Page Settings sidebar, showing the dropdown to select a different page template.

↑ Table of Contents ↑

Template Hierarchy

Before getting into how to edit templates, understanding the template hierarchy is important. There are a few base templates that are generated automatically when you select a theme. WordPress uses these templates to create default styles for specific page types. For example:

  • If your site is set up to display the latest posts on the front page, the Home or Index template applies the style for that page.
  • If your site is set up to display a regular page on the front, the Front page or Page template applies the style for the home page.
  • Many block themes offer common built-in templates like the Single Post to customize the appearance of single blog posts, or the 404 template for customizing the 404 error pages.
  • The Archive template is always used for categories/archives but not the posts page.

💡

When you first open the Site Editor, it loads whichever template styles the home page of the site.

If you’re interested in the more technical aspects of how these templates are set up, you can check out the Theme Handbook on WordPress.org.

↑ Table of Contents ↑

How To Edit Templates

Editing templates is a new concept introduced to WordPress to give you even more control over the layout of your content. The Template Editor is available on certain themes to create custom templates and assign your templates to specific pages and posts.

By now, you may be used to editing your content using the WordPress page & post editor. Taking this further, you may switch to the Template Editor to edit the full layout of pages and posts, including the header elements (such as the site title and tagline), the footer, and how the content is presented within the page or post, all using blocks.

For example, if you want your site title to appear differently on some pages only, you can make edits to that page’s template as shown here:

Access the Template Editor via the Page/Post Editor

While you’re working on a page or post, look for Template in the settings in the right sidebar. You will see the current template in use. Click Edit to switch to the Template Editor and edit that template:

The Edit template hyperlink that shows after clicking the template name in the Page Settings sidebar.

Once you have selected a template to edit, the Template Editor will open. You will know you’re editing a template rather than a page or post because a dark frame will appear around the content (1), the template name will be shown at the top (2), and the word ‘template’ will appear in the settings sidebar (3):

Annotated screenshot showing a dark frame around the content labelled 1, the template name shown at the top labelled 2, and the word 'template' in the settings sidebar labelled 3.
How to know you’re editing a template
Access the Template Editor via the Site Editor

You can also edit templates via the Site Editor. Go to Appearance → Editor in your dashboard. You will be taken to the template your homepage uses. To switch to editing a different template, click your site icon in the upper left corner and select Templates.

Choose a Template to Edit

Your theme includes a set of templates that you can edit directly. To view these, click your site icon in the upper left corner and select Templates. You will see a list of templates, including any new templates you have created. To edit any template, click the name, and you will be taken to the template editor for that template.

View The Structure of Your Template

To see a list of all the blocks in your template, click on List View at the top of the screen (the icon looks like three horizontal lines.)

This is useful to see the overall structure of your template before you start editing specific sections. You can then click on any block in the List View to change that block’s settings.

List View showing a list of blocks in the Template Editor
List View in the Template Editor
Edit the Template Blocks

In the Template Editor, click on any block to adjust the content or change the block settings. Some of the actions you can take here include:

The possibilities are endless!

Save Changes

When you’re finished making edits, click Save in the upper right corner.

The affected template will be shown here. Click Save again to confirm you wish to save the changes made to that template.

You can then click your site icon in the upper left corner to return to exit the editor.

The Save button is in the top corner, to the left of Cancel.

↑ Table of Contents ↑

Reset a Template

You can reset a template back to its original state, undoing all the changes you made.

  1. From the Site Editor, click on your site icon in the top left corner.
  2. Select Templates to view all your templates.
  3. Click the three dots next to the template you want to reset.
  4. Select Clear customizations. The changes will immediately be reverted.
How to reset a template in the Site Editor.

↑ Table of Contents ↑

Examples of How to Use the Template Editor

There are many ways to use the template editor to create beautiful custom layouts. Here are some examples for inspiration.

Add a Custom Menu

If you want to display a custom menu on specific pages only, you can add a Navigation block using the Template Editor as shown in the video below:

You can customize your footer to appear differently on different pages, as demonstrated in the video below:

↑ Table of Contents ↑

Create a New Template

You may design a new template and apply that template to specific pages or posts. Follow these steps to create a new template:

  1. In the Page Settings in the right sidebar, click the template name, then click the Add template icon.
  2. Give your new template a descriptive name and click Create.
  3. In the Template Editor, you can now edit the structure in which your page is displayed.
  4. When you’re done, click Update in the top right corner to save your new template.
  5. Click Back to return to the page/post editor, where your newly-created template is in the list of available templates.
The Template selection box open with an arrow pointing to the Add Template logo in the top right of the box.

↑ Table of Contents ↑

Apply a Template

Once you have customized your template or created a new one, you can apply it to a specific page or post using the following steps.

  1. Add or edit the page/post you want to apply the template to.
  2. In the Settings sidebar locate the Template section. If you don’t see the Settings sidebar, click the settings icon next to Publish or Update to open your Settings sidebar.
  3. Choose the template you want to apply.

You can preview how the page or post will look with the template applied. Click the Preview option at the top of the editor, and select Preview in new tab.

Once you’re satisfied with the template and the content of the page/post, click Publish. Or, if the page/post was already published, click Update to apply your changes to the published page.

The Page Settings sidebar with the Template section expanded to display the different page template options.

📌

Some templates are applied automatically. For example, the Archives template is automatically used for categories/archive pages, so it will not appear in the list for individual pages or posts.

Not quite what you're looking for?

Get Help