delta

Template types and includes

A template is markup that many pages share. Seven types answer a WordPress request; one is a reusable piece you drop into the others.

The eight types

Type Renders
Single One entry: a post, a page, a product
Archive A listing: the blog, a category, an author
Search Results The search page
404 The not-found page
Loop item One row inside a listing
Header The chrome above every page
Footer The chrome below it
Regular A reusable piece, on no page by itself

The first seven go live through display conditions. A regular template appears only where you include it. WooCommerce adds its own types when the plugin is active.

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. Designated defaults cannot be deleted at all.

For developers

Type slugs: single, archive, search, error, loop_item, 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. Designated defaults return 21press_delta_default_template_protected.

Related