Log in Request my site

Decide the look with templates

A template is the layout of a kind of pages: all your pages, the contents of a type, a list, the search or the 404 page. This article teaches you to create a template, to know which one applies to a page and to place the content in it.

Before you start

  • All the pages of the same kind adopt its template, with no page-by-page setting.
  • Creating, editing and deleting a template does not require the Administrator role. A member who can edit contents can create a template.
  • For a content type, first create the type. Its templates appear in the list of templates to create. Create a content type describes this step.
  • Like everything else, a template is edited in Staging. It goes online at the next site publication.
  • Six templates are required to publish the site. The section Prepare the required templates lists them.

Open the templates screen

In the administration menu, open Templates. The screen shows at the top the Template hierarchy, then the table of your templates with their Title and their Slug. On a multilingual site, a Language column is added.

The hierarchy sorts the kinds of pages into three groups: Archives, Singular and Special. A solid box has its template and a dotted box does not have one yet. Clicking a dotted box opens the Add template window on that kind of pages.

The template hierarchy of Atelier Sauge: in Archives, the Archive of a type row with archive-{type} solid; in Singular, Project with single-project solid, Service, Media and Page with page solid, the type rows and Media linked to the fallback single box solid; in Special, front-page, search, 404 and modal solid, the three modals at the bottom and side dotted.

Under the hierarchy, the table gives the title and the slug of each template. The slug names the kind of pages it lays out.

The templates table: 404 (Not Found), Single Item (any type), Generic (all contents), Home page and Pages carry Protected; Search Results, All entries: Projects and Content type: Projects carry the Delete button.

The Home menu, at the top of the administration menu, opens the home page template.

Create a template

  1. In the Templates screen, click Add template. A window lists the kinds of pages that a template can lay out.
  2. Click the kind you want, for example Single item: Projects.
  3. If the window asks, choose between For all items and For a specific item.
  4. For a specific item, look for it in the list then click it. An item that has its template is not offered.
  5. The editor opens on the Lovely Render creations block, which offers the creations made for this template. Choose one or build the template with your own blocks.
  6. Publish the template. The pages of this kind take its layout.
The Add template window: Home page, Pages, Content type archives, Single Item (any type), 404 (Not Found), Search Results, Media pages, the four modals, Side panel, then Single item: Projects and Single item: Services, each with its description.

For Single item: Projects, the window offers a template for all the projects or for a single one. For a single one, it lists the projects that do not have their template yet.

The scope step for Single item: Projects: All entries: Projects (For all items), Project (For a specific item) and the Back button.
The list of projects under the Search field: A city garden in Rezé, Vegetable terrace in Rezé, Raised vegetable garden in Orvault, Dry garden in Vertou, Country hedge in Carquefou and Shade garden in Saint-Herblain.

A new template is created as a draft. As long as you have not published it, the pages it targets keep their earlier layout. If you close the editor without choosing a creation, the template stays empty.

Prepare the required templates

The site does not go to Production until six templates are published on Staging. Without one of them, part of the site would display badly online.

The required templates
TemplateWithout it
Home pageThe home page has no layout.
PagesA page that no more specific template covers shows the 404 error page.
Single Item (any type)A content that no more specific template covers shows the 404 error page.
404 (Not Found)An address that leads nowhere shows the error page supplied with Lovely Render.
ModalA page opened in a modal takes the Pages template, with the site’s header and footer in the window.
Side panelA page opened in a side panel also takes the Pages template.

These are the first six steps of the Setup checklist box on the dashboard. Each step opens its template and creates it if it does not exist yet. A draft template does not count: publish it. The creations catalog offers Modal: generic for the modal as for the side panel.

As long as one is missing, the Publish website to production screen names them and keeps its button grayed out. Publish your site describes this screen.

Choose the kind of pages

The templates in the Add template window
TemplatePages concernedScope
Home pageThe site’s home page.The whole site.
PagesAll the pages of the site.All pages, or a specific page.
Single item: followed by the name of a typeThe page of each content of this type, or of each term of a category.All the contents of the type, or a specific content.
Single Item (any type)The page of any content that no more specific template covers.All types.
CPT ArchivesThe page that lists the contents of a type, for example /projects/.A specific type.
Search ResultsThe results page of a search on the site.All searches, or those of a specific type.
404 (Not Found)The page displayed when an address leads nowhere.The whole site.
Attachment pagesThe page of each media.All media.
Modal, Modal at the bottom left, Modal at the bottom center, Modal at the bottom rightA content opened over a page.All contents, a type or a specific content.
Side panelA content opened at the side of the page.All contents, a type or a specific content.

Single item: appears only for a type whose Each item has its own page setting is checked. CPT Archives offers only the types that have a Has archive page. A category has no page per term when created: it offers no template until you give it one.

Understand which template applies

To display a page, the site looks for the most specific template, then goes down to the most general ones. The first published template found applies.

The template search order
Page displayedTemplates searched, from the most specific to the most general
A pageThat of this page, then Pages. Without them, the page ends up on the 404 page.
A content of a type, or a termThat of this content, then that of its type or its category, then Single Item (any type). Without them, the content ends up on the 404 page.
The list of a typeThat of the archive of this type. Without it, the list ends up on the 404 page.
A search limited to a typeThat of the search in this type, then Search Results.
A content opened in a modalThat of this content, then that of its type, then Modal. The three modals at the bottom fall back to the centered Modal when they have no template.
A content opened in a side panelThat of this content, then that of its type, then Side panel. The panel does not fall back to the Modal.

On Staging, a content opened over the page with no modal or panel template takes its own template, for example Pages for a page. If you can create templates, the window instead shows you the missing templates, as the section Find the template that a page is missing says. This case never happens online, since Modal and Side panel are required to publish.

You can add special cases without conflict. For example, a template for the single project Dry garden in Vertou comes before the one for all projects.

Find the template that a page is missing

On Staging, a page, a content or a list that no published template lays out does not show you the 404 page if you can create templates. The heading No published template shows this page shows instead, with the templates the site looked for at this address, in search order. Each row gives the name of the template as the Templates screen shows it, its slug and a link.

The links in the list of templates searched
LinkWhenEffect
Create this templateNo template has this slug yet.Creates the template as a draft and opens it in the editor, on the creations made for it.
Open the draftThe template exists as a draft.Opens the draft in the editor.

Build one of these templates then publish it: the address takes its layout.

  • Other members and people who came through a preview link see the 404 page, as in Production. Share a preview of Staging describes these links.
  • In Production, the address shows the 404 page as long as none of these templates is published.
  • An address that leads nowhere, like a typo, shows the 404 page on Staging too.
  • A content opened in a modal or side panel with no modal or panel template shows the same list in its window, with the modal or panel templates the site looked for.

Place the content in the template

The Post content block marks where the content of the visited page shows. It is offered only in a template’s editor and has no settings. The margins, background or border around the content are set on the block that surrounds it.

  • Placed at the root of the template, it shows the content of the page. In the editor, it shows this instead: Post content will appear here.
  • Placed in the repeated item of a list, it shows the content of each listed item.

A page or content template without this block shows the page without its content. A notice flags this at the top of the editor: This template dresses one entry but shows none of its content: add the “Post content” block where the entry should appear. It disappears when you place the block. Once closed, it does not come back on this template.

The home page, an archive, a modal and the side panel do not receive this notice. They show a composed page, a list or a composition as well as a content.

Set the 404 error page

As long as no 404 (Not Found) template is published, an address that leads nowhere shows the page supplied with Lovely Render. It shows the heading Error 404: page not found and an image. This heading follows the Heading 2 style of your design.

Once published, your 404 template serves all the errors of the site. It shows for an unknown address, a technical WordPress address requested by a bot or a content you made unviewable. Only the address /wp-admin typed on your domain name keeps the page supplied with Lovely Render.

Set the search results page

The Search Results template is optional. Without it, a search keeps the template of the page it started from, the home page or the list of a type. With it, the results have their own layout. A search template limited to a type comes before the general template for searches made in that type.

Go back to a version of a template

A template keeps a revision at each save, like a page. In the template’s editor, open its revisions to compare two states and restore the previous one.

Delete a template

  1. In the table of the Templates screen, find the template’s row.
  2. Click Delete. A window asks Delete “…”? with the template’s title, and reminds you that it will be deleted permanently, with its revisions.
  3. Click Delete to confirm, or Cancel to keep the template. Once the template is deleted, the screen reloads and the pages concerned take the next template in the search order.

The trash icon of a box in the hierarchy opens the same window.

The templates Home page, Pages, Single Item (any type), 404 (Not Found), the four modals and the Side panel carry Protected in place of the button. Neither they nor their translations can be deleted. They stay editable. Search Results is not protected: it carries the Delete button.

Entrust a template to your AI

An AI connected to your site creates and rewrites a template in Staging, never in Production. You must be an administrator of the site and have granted it the right to edit templates and compositions. This right is never checked in advance. Connect your AI describes these rights.

  • It chooses the kind of pages from the list the site gives it. It never changes the target of an existing template.
  • A template it creates arrives with its blocks and published. A creation with no block is refused.
  • A rewrite replaces the entire template. The blocks it did not touch come back identical.
  • The filters of a list, its search box and the breadcrumb are placed by hand in the editor.

See also

Updated on

All documentation pages