Use the Template tag, or [template] shortcode, to render a template post.

Find its ID or name in the template edit screen, in the Publish metabox.

By name

To get a template by post name (also called a "slug"), use the name attribute.

<Template name=test-template />


To get a template by post ID, use the id attribute.

<Template id=74 />


The [template] shortcode works the same way as the Template tag.

[template id=74]

This is useful for embedding a template from locations where shortcodes can be used.

From PHP

Use the function tangible_template to work with templates in PHP.

From string

It can render a template directly, like do_shortcode.

echo tangible_template('<Field title />');

From file

To load a template file:

echo tangible_template()->load_file( __DIR__ . '/example.html' );

This requires the full path to the file, so the __DIR__ constant is used to get the template path relative to the current PHP file.

From post

To load a template post:

echo tangible_template()->load_post([
  'id' => 74

Theme files

Use the Template tag with theme attribute to load sidebar and other theme template files.


<Template theme=sidebar />

Alternate sidebar

<Template theme=sidebar name=product />

The above will load sidebar-product.php.

Search form

<Template theme=search />

Template part

<Template theme=part name="template-parts/footer-menu" />