by

WordPress has supported custom page templates for over 12 years, allowing developers to create various layouts for specific pages, and allowing users to select a specific template for each page they create.
While this feature is very helpful, it has always been limited to the ‘page’ post type and was not available to other post types.

By opening up the page template functionality to all post types, developers will be able to add more than one template for any post type available on a site, and users will then be able to choose a template for individual pieces of content.

In addition to the Template Name file header, the post types supported by a template can be specified using Template Post Type: post, foo, bar.
When at least one template exists for a post type, the ‘Post Attributes’ meta box will be displayed in the back end, without the need to add post type support for ‘page-attributes’. ‘Post Attributes’ can be customized per post type using the ‘attributes’ label when registering a post type.


Respond

Leave a Reply

Discuss this

Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.