[wp-trac] [WordPress Trac] #12759: "Template" shouldn't show for custom hierarchical post types

WordPress Trac wp-trac at lists.automattic.com
Sun Jan 23 18:18:48 UTC 2011


#12759: "Template" shouldn't show for custom hierarchical post types
--------------------------+-----------------------
 Reporter:  greenshady    |       Owner:
     Type:  defect (bug)  |      Status:  reopened
 Priority:  normal        |   Milestone:  3.0
Component:  Post Types    |     Version:  3.0
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |
--------------------------+-----------------------
Changes (by elementweb):

 * cc: elementweb (added)
 * status:  closed => reopened
 * resolution:  fixed =>


Comment:

 This seems a poor solution, as custom templates do not have to be reserved
 for page types. Before custom post types, they were indeed only used for
 page types, but that is only a matter of what the post type supports.

 If a post type (whether by default, as for pages, or custom) supports
 page-attributes, there is no reason it should not allow for custom
 templates to be selected. Doing so basically tells the post type to behave
 like a page, and as such it should have all the functionality of a page.

 This restricts functionality for the whole platform out of the personal
 preference of one or a few persons. It also contradicts the documentation
 (which should either be adjusted to reflect this decision, if the current
 proposal is deemed unacceptable).

 It would be best to allow custom templates to be used when a post type has
 page attributes (so as not to arbitrarily restrict functionality) until a
 better choice is made, for example the addition of a restriction for
 custom templates.

   Custom post types should not use templates created for a different post
 type.

 This is particularly wrong as custom templates are not created
 specifically for pages, there is no such distinction other than the fact
 that before custom post types, it was their only use. Custom post types
 have changed this paradigm.

 A rather "easy" fix would be to add an optional attribute to custom
 templates that either limits or restricts post types (by default either to
 "page" post type or to all). Although I do note that there are several
 changes necessary for this as page attributes are set to be saved in
 several places only for the "page" post type.

 I have found that there are 2 distinct places to patch to allow the page
 template to be save, but there are other places to check as the meta box
 does not reload the selected page template (even though correctly saved in
 postmeta) and the page template is not loaded. Basically is_page() would
 come down to checking whether the post type supports page-attributes.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/12759#comment:7>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list