WordPress.org

Ready to get started?Download WordPress

Forums

page template dropdown for post types other than 'page' (4 posts)

  1. asecondwill
    Member
    Posted 3 years ago #

    WP - 3.0-RC3-15257

    Hi I have made some post types with capability type "page" and supports page-attributes switched on. I get a metabox for attributes, but just with "order". No template selector shows up.

    that's because of this:

    http://core.trac.wordpress.org/changeset/14642

    Isn't template selecting part of the page type capabilities? Why have they been excluded like that? Is this a bug?

    Thanks

    Will

  2. mayG
    Member
    Posted 3 years ago #

    i see the same problem.. has anybody managed to resolve this?

  3. mayG
    Member
    Posted 3 years ago #

    ok i just managed to resolve this..

    there is a file meta-boxes.php within wp-admin\includes of the wordpress installation.. line 547 of the file, which is the function page_attributes_meta_box() just add the check for your particular post type name to be able to display the template pages drop down.

    if ( ('page' == $post->post_type  || 'yourcustomposttype' == $post->post_type) && 0 != count( get_page_templates() ) ) {
    		$template = !empty($post->page_template) ? $post->page_template : false;
    		?>
  4. jsims281
    Member
    Posted 3 years ago #

    mayG, that's fantastic. It works for displaying the drop down list but (for me at least), it won't save the data.

    The data in "parent" saves fine but the template always just goes back to default...any ideas?

Topic Closed

This topic has been closed to new replies.

About this Topic