• During the development of the Magic Fields 2 plugin we hit a strict limitation in regards of the page template attribute. The page template attribute is only allowed (displayed, saved, etc) when the post_type is page, not when the capability_type is page, so custom types based on the built-in page type cannot use page_template.

    Here is an example from wp-admin/includes/meta-boxes.php, line 583:


    if ( 'page' == $post->post_type && 0 != count( get_page_templates() ) ) {

    If this is changed to something like this:

    $ct = get_post_type_object($post->post_type)->capability_type;
    if ( 'page' == $ct && 0 != count( get_page_templates() ) ) {

    then the page template attributes will not only displayed for the built-in page types, but for the custom types built on it aswell. Other lines which could/should be changed: wp-admin/includes/post.php line 479 and wp-includes/post.php line 2636.

    Is there a reason why the page template attribute is only allowed for the built-in page type? Could these changes be implemented into WordPress?

  • The topic ‘The page_template support should be expanded’ is closed to new replies.