[wp-trac] [WordPress Trac] #13272: Custom post types not loading custom templates from admin page
WordPress Trac
wp-trac at lists.automattic.com
Thu May 6 09:19:16 UTC 2010
#13272: Custom post types not loading custom templates from admin page
--------------------------+-------------------------------------------------
Reporter: beekado | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Unassigned
Component: General | Version: 3.0
Severity: normal | Keywords:
--------------------------+-------------------------------------------------
I've been trying to assign custom templates with custom post types
supporting 'page-attributes'. From the front end, creating single-xxx.php
(xxx = custom post type) works, but from the backend the dropdown always
shows "Default Template" even though the other custom template is in the
list.
I checked the DB and _wp_page_template is not being saved in wp_postmeta
for a custom post. After I manually added an entry in the table, it was
still not showing up. This must be due to the following in wp-
admin/includes/post.php:
function get_post_to_edit( $id ) {
$post = get_post( $id, OBJECT, 'edit' );
if ( $post->post_type == 'page' )
$post->page_template = get_post_meta( $id,
'_wp_page_template', true );
return $post;
}
By commenting 'if ( $post->post_type == 'page' )' the template is now
picked up. However, when trying to update it the value in the dropdown
does not change (did not investigate updates yet)
Another thing I also noticed is that after doing the above, the template
is not chosen on the front end unless the page name starts with
single-[something].php
I'm not sure if this is supposed to happen or not, but some plugins like
MultiEdit rely on the value in the admin dropdown to function properly.
Let me know if the above makes sense.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/13272>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list