Template Editor
Description
The Template Editor lets you design custom templates for your posts and pages using the block editor. To put it differently, it allows block editor users to edit and create templates that a page or post uses. Similar to the Site Editor, this feature allows you to edit and create content using blocks, including various theme blocks.
Objectives
After completing this lesson, participants will be able to:
- Distinguish between the Template Editor and Site Editor.
- Identify the difference between templates provided by your theme and custom templates.
- Use the Template Editor via the WordPress Block Editor.
- Use the Template Editor via the Site Editor.
- Assign a template to a post or page.
- Clear customizations.
- Delete a template.
Prerequisite Skills
Participants will get the most from this lesson if they have familiarity with:
Readiness Questions
- Are you familiar with full site editing?
- Have you installed a block theme?
- Do you feel comfortable using templates and template parts?
- What is the difference between the Site Editor and the Template Editor?
Materials Needed
- A local install of WordPress.
- A WordPress.org user account.
- A block theme.
Notes for the Presenter
- The Template Editor is used to edit and create templates that a page or post uses, and can override primary templates assigned by the Site Editor.
- It will be helpful to show how custom templates can be created when using the Template Editor.
- Template Editing Mode is the feature of full site editing that unlocks the ability to switch between editing the content of an individual post/page and the template that an individual post/page uses.
Lesson Outline
- Introduction to the Template Editor and Site Editor
- Identify the difference between templates provided by your theme and custom templates.
- Explore two different ways to access the Template Editor.
- How to clear customizations.
- How to delete a custom template.
Exercises
- Create a custom landing page using the Template Editor.
- Assign a different template to a page or post using the Template Editor.
Assessment
What is the function of the Template Editor?
- The Template Editor allows you to add content to your pages and posts.
- The Template Editor lets you edit and assign templates to individual posts or pages.
Answer: 2
You can access the Template Editor in two ways. Select all that apply.
- If you are using a block theme, you can access the Template Editor when editing posts or pages via the WordPress Block Editor and also via the Site Editor.
- If you are using a classic theme you can open the Customizer and search for the Template Editor there.
- If you are using a classic theme that has enabled the Template Editor on the backend, you can access the Template Editor only when editing posts or pages via the WordPress Block Editor.
Answer: 1 and 3
The theme you are using will determine what type of templates are available.
- True
- False
Answer: 1. True
You can create custom templates via the Site Editor.
- True
- False
Answer: 2. False
You can assign a custom page template to more than one page or post.
- True
- False
Answer: 1. True
Additional Resources
- Template Editor
- Intro to the Site Editor and Template Editor
- Understanding Page Editor vs. the Site Editor
- Templates
- Template Parts
Example Lesson
The Template Editor allows you to edit and create templates, using blocks. These templates control the look and feel of the posts, pages, or page types on your site. The Template Editor is only available if your site is using a block theme or a classic theme that has enabled the Template Editor on the backend.
You may be asking, what is the difference between the Site Editor and the Template Editor? The Template Editor lets you edit and assign templates to individual posts or pages. The Site Editor on the other hand lets you create site-wide templates for your site. For example, you could use the Site Editor to edit a template for all your pages, but you will still have the ability to override this by assigning a new custom template you created using the Template Editor. Since the release of 6.1, you can also create a custom template in the Site Editor.
About Templates
WordPress uses templates to create the layout and structure for posts, pages, or specific page types on your site page. There are a few base templates that are generated when you select a theme. For example:
- The Home template is used to display the site’s home page if your site is set up to display the latest posts on the home page.
- The Index template is used to display the index page of all the blog posts.
- The Page template is used to display the site’s pages if no specific templates are assigned to the page.
- Many block themes offer other built-in templates like the Single Post template to customize the layout of single blog posts, the 404 template to customize the layout of the 404 error page, the Search template to customize the layout of the search results page, and the Archive template for categories/archives page, etc.
In addition, your block theme may come bundled with custom templates.
In the Template Editor, you can find all the templates on your site, including any custom templates you created and the ones that came bundled with your theme. You can edit these templates and create custom layouts using blocks.
What you need to use the Template Editor
To work with the Template Editor, you will need a block theme with WordPress 5.9 or later on your site or a classic theme that has enabled the Template Editor in the backend.
A block theme is a theme that uses blocks for all parts of a site, including navigation menus, header, content, and site footer. All blocks that are available in the WordPress Block Editor can be used in the Template Editor. A set of blocks called Theme blocks are specifically built for the Site Editor and Template Editor.
You can find block themes in the WordPress theme directory by selecting Block Themes or Full Site Editing in the feature filter: