Friday 28 October 2016

WordPress 4.7 Brings Custom Page Template Functionality to All Post Types


photo credit: Mari Pi WordPress 4.7 will introduce support for post type templates, an exciting new feature for theme and plugin developers. Page templates, which allow developers to specify a different layout or design for a page, are nearly as old as WordPress itself. For years developers have coveted that same functionality for other post types. In fact, a plugin that attempted to create this functionality (Custom Post Template), has more than 50,000 active installs, despite not having been updated for four years.
Post type templates follow a format similar to that of the existing custom page templates. The author can specify a template name as well as the post types where the template will be available as a dropdown in the page attributes metabox.
/*
* Template Name: Foggy Memories
* Template Type: memory, event
*/
The current implementation of post type templates can be used with any post type that supports page-attributes, which means that it will not work with regular posts by default. I think they would be more immediately useful for the average user who likes to tinker with templates if they worked with posts by default, but the assumption is that developers are likely the
Source: https://managewp.org/articles/13713/wordpress-4-7-brings-custom-page-template-functionality-to-all-post-types




source https://williechiu40.wordpress.com/2016/10/28/wordpress-4-7-brings-custom-page-template-functionality-to-all-post-types/

No comments:

Post a Comment