Skip to content
delta

Template types and includes

A template is markup that many pages share. Eight types render part of a page; one is a reusable piece you drop into the others.

The nine types

TypeRenders
SingleOne entry: a post, a page, a product
ArchiveA listing: the blog, a category, an author
Search ResultsThe search page
404The not-found page
Loop itemOne row inside a listing
CommentsThe comment list and comment form on an entry
HeaderThe chrome above every page
FooterThe chrome below it
RegularA reusable piece, on no page by itself

Single, Archive, Header and Footer go live through display conditions. Search Results and 404 need no conditions: the type selects the page. Loop items and comments templates appear where another template names them by slug. A regular template appears only where you include it. WooCommerce adds its own types when the plugin is active.

A new site has no templates

Delta ships no templates. Until you build them, Delta shows a plain layout on every page:

  • The header is the site name, linked to the home page.
  • The footer is the copyright year and the site name.
  • A post or page shows its title and content, plus comments when they are open.
  • The blog, archives and search show a heading and a linked list of post titles, with pagination.

The agent can build the basic set for you: header, footer, single, archive, search, 404, a loop item and comments, plus shop templates when WooCommerce is active. It checks what exists first and does not replace a template without your clear yes.

“Build the basic site templates.”

Any page type you do not build keeps the plain layout until you do.

Includes

Build a piece once and reuse it. Put {{include:slug}} where you want it:

“Make the call-to-action band a reusable template and include it on the three service pages.”

Edit the template once and all three pages change. The included template brings its own CSS and JavaScript.

Only published regular templates can be included. Includes nest five levels deep. A cycle, or a slug that does not exist, leaves the placeholder on the page rather than looping or failing silently.

Include or copy

Link inserts an include, so the page follows the template. Replace, append and prepend paste a copy the page owns. Ask the agent to detach an include into a copy, or relink a copy back.

Deleting

Delta refuses to delete a template that other documents include, and names them.

When you save a template, Delta names any template it ties with and any template that shows nowhere. See Display conditions.

Sites upgraded from a version before 0.2.0 can still have designated default templates. You can delete them, set them to draft, or change their type like any other template. Theme updates never overwrite your templates.

For developers

Type slugs: single, archive, search, error, loop_item, comments, header, footer, regular. Legacy section, page, partial coerce to regular. Registry filter: 21press_delta_template_type_registry.

{{include:ref}} takes a slug or numeric ID, resolves published includeable types only, and caps at depth 5. Depth, cycle, or miss returns the placeholder unexpanded; nested CSS and JS collection uses the same guards.

Deleting an included template returns 21press_delta_template_in_use with a reference count, bypassable with force: true.

Related