Make WordPress Core

Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#13272 closed defect (bug) (duplicate)

Custom post types not loading custom templates from admin page

Reported by: beekado's profile beekado Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: General Keywords:
Focuses: Cc:

Description

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.

Change History (4)

#1 @greenshady
14 years ago

See #12759 as the original ticket dealing with this.

#2 @beekado
14 years ago

Thanks

#3 @hakre
14 years ago

  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #12759 , should be fixed.

#4 @nacin
14 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.