Both Views and Layouts can be used to create templates for custom posts. Our recommended workflow assumes you use Template Layouts, but there are times when you may want to use Views Content Templates.

Below we first refresh how Toolset templates combine with a theme’s PHP template files to render a page, before describing when you might choose to use a Content Template instead of a Layout Template for your post types.

Templates and your theme

You use Toolset to design templates for custom posts because a theme’s PHP template files are intended to output standard WordPress content only and will not render custom content created with Toolset such as custom fields and taxonomies.

What happens when a template is assigned to a custom post type is the same for both Content Templates and for Template Layouts.

When you visit a single custom post on the front end your theme PHP template files will be invoked according to the Template Hierarchy as normal, rendering the header and footer, and typically outputting the post title. The built-in WordPress function the_content() would then normally render the post body, but Toolset hooks into the process and renders the assigned template in its place instead.

Both Template Layouts and Content Templates can be assigned to multiple post types, and the assignment can be
overridden for individual posts from the post edit screen.

Template Layouts have a higher priority than Content Templates. If you try to assign both to the same post type the Template Layout will be used.

When to use Content Templates

When assigned to custom posts Content Templates and Template Layouts do the same thing. Which one you use is largely a matter of personal preference, but the presumption is you will normally want to use Template Layouts to take advantage of the drag-and-drop Layouts Editor which gives you more control over what content appears where.

The main use case when you would need to use a Views Content Template is if you want to design the template using a supported page builder. You can create a Content Template and edit it with Visual Composer or Beaver Builder.

A less-common use case is that you can use <script> tags inside a Content Template, but if you add them inside a Template Layout they will be stripped.

To create a Content Template visit the Toolset &GT; Content Template page. Content Templates listed here will include templates assigned to custom post types as well as unassigned templates. These are snippets of HTML markup and shortcodes which can be inserted anywhere on your site with the wpv-post-body shortcode.

A special kind of unassigned template are Content Templates created by the Loop Wizard of a View. We refer to these special templates as View Templates and they can only be used by, or deleted from, the View which created them.

Archive templates

You can also use either Views or Layouts to design custom post archives.

However, the archive itself—the actual list of posts—is always generated by a Views custom WordPress Archive.

You can create a custom WordPress Archive with Views and assign it directly to the chosen archive, or you can insert the custom archive into a Layout using a WordPress Archive cell and then assign this Archive Layout to a post type or other archive.

The benefit of using Layouts to create a template for an archive is that it can contain other content as well as the list of posts itself.

Fully-integrated themes

The above description assumes you are not using a fully-integrated theme, and is recommended for most users. With a fully-integrated theme Layouts intervenes earlier in the page-rendering process. Instead of hooking into the_content() it takes over rendering the entire page, and Layouts templates become responsible not just for the content area but for generating headers and footers, too.