How To Create and Use Template
Since version 5.9, WordPress has new features called Site Editing which utilized templates as it main features to build the whole site.
Templates are different from Pages.
Usually you access Pages from Dashboard->Pages and cannot be used as a place to build your whole sites, since you cannot edit pages such as 404, archive, search, category, etc without you installing a third party plugin.
Templates are located in Dashboard->Appearance->Editor and can be used to edit pretty much the whole frontend aspect of the site including the one you cannot edit in Pages (404, search, etc).
How to Create a Template
First you need to go to Appearance->Editor. If your site doesn’t have this option then it means your Theme you used doesn’t support WordPress Site Editing.
Then a Site Editor will be opened :
- Inside the Site Editor, click on the WordPress Logo on top left corner,
- Then a side bar will opened and click on the option Templates,
- Click on Add New button on top right corner
- A popup will appear and you can choose which type of template you want to add
- If you want to add your own custom template, you can click on the Custom Template option
How to Use a Template
There are two types of templates in WordPress :
– Default hierarchy templates
– Custom templates
Default templates such as Front Page, Home, Single, Page, Index, 404, Search, Archive are loaded automatically by WordPress according to their hierarchical location. For example the 404 template will be loaded on your Not Found page.
For more info regarding WordPress template hierarchy, please visit this site.
Custom templates however doesn’t load automatically because it’s not part of the WordPress template hierarchy and some existing one usually bundled within the theme from the author themselves, such as About, Contact, Projects, Services, etc. This templates needs to be assigned manually by you through the Pages dashboard.
Here is how to do it :
- First go to Dashboard->Pages->All Pages
- Choose a page you want to edit, and click Quick Edit
- On the template option, change it to any custom template you want to assign to that page.
Note that the template’s content will replace all the content you put inside the page you assign it to.
Unless the template contain a Post Content block, then it will load the page content inside the Post Content block.