Contextually Assign a Template​

  • Updated: 2020-06-09
  • First posted: 2020-06-09

A contextually assigned template is a page or content layout template that will be used based on either the type of page being displayed or the type of content shown within the page. These are assigned when a different layout is needed for different parts of a site.

Page layout templates can be assigned to page types, whereas content layout template can be assigned to post types for display of post content on category or archive page types.

Usage examples:

  1. The Front page with one column and no title, vs Post pages with a title, post meta information and comments – each would have it’s own page layout template assigned, with the layout assigned to Post pages being used for the display or all post pages.
  2. Within the home page the display a post under latest blog posts would differ from the display of an event under upcoming events – each of the post type and event (post) type would have it’s own content layout template assigned.

How to do it

  1. Add or edit a template to be assigned.
  2. Navigate to Page Settings and open the Layout section.
  3. Select all page or post types the template should be applied to.
  4. Update to save.

Any pages/posts that do not specifically override this will now be displayed using this template for layout and design.

Notes:

  • If another template has been applied to the page or post type it will be replaced as such when this template is saved with the new setting.
  • The template must be published to be used – when an unpublished template is applied the global default (if there is one) will be used instead.
  • For page layout templates with Content Placeholder widget must be used (it is optional for content layout templates).
  • Any new custom post types added to your website can have have a content layout template assigned for the display of that post type’s content. If the custom post type is configured with an archive page, a page layout template can be assigned to that.

Leave a Reply

Your email address will not be published. Required fields are marked *

Stay in touch

Receive the latest news and articles from Amibe…