821 posts
  • Power Elite Author: Sold between 1 000 000 - 1 999 999 dollars
  • Power Elite Author
  • Won a Competition
  • Exclusive Author
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Europe
  • Bought between 50 and 99 items
+2 more
wpbakery says

How can you let users to select page template for custom post type?

I’m calling register_post_type with ‘hierarchical’ => true and ‘supports’ => array(‘editor’, ‘title’, ‘page-attributes’), but template selection dropbox doesn’t appear :(

Thanks!

2 posts
  • Bought between 1 and 9 items
  • Has been a member for 5-6 years
pauliewalnuts says

I’m having the same issue, have you found a solution?

2 posts
  • Bought between 1 and 9 items
  • Has been a member for 5-6 years
pauliewalnuts says

Should anyone have this same issue, it’s because they are post types, not pages, hence the page template selection drop down will not show….

I used <?php if(is_single(‘id’)){ }?> in my single.php to display the additional custom template pieces I needed.

Cheers

4305 posts ThemeForest Reviewer
  • Envato Staff
  • Reviewer
  • Community Moderator
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Venezuela
  • Has been a member for 5-6 years
  • Envato Studio (Microlancer) Beta Tester
  • Sold between 10 000 and 50 000 dollars
  • Exclusive Author
+9 more
Ivor Reviewer says

Hey Michael maybe this will help http://wordpress.stackexchange.com/questions/2765/adding-page-attributes-metabox-and-page-templates-to-the-posts-edit-page

See the last answer

Just change this:
add_action('add_meta_boxes','add_post_template_metabox');
function add_post_template_metabox() {
    add_meta_box('postparentdiv', __('Post Template'), 'post_template_meta_box', 'post', 'side', 'core');
}

To this:

add_action('add_meta_boxes','add_post_template_metabox');
function add_post_template_metabox() {
    add_meta_box('postparentdiv', __('Post Template'), 'post_template_meta_box', 'custom_post-type', 'side', 'core');
}

Where custom_post_type is the slug of your post type.

Tell me the results mate :grin:

EDIT :Not sure if this is the best solution, Codex says ”’page-attributes’ (template and menu order, hierarchical must be true)”

Maybe you can ask in http://wpquestions.com/ or check this article http://www.twothirdsdesign.co.uk/article/2010/03/setting-templates-for-wordpress-3-0-custom-post-type/

751 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Referred between 1 and 9 users
  • United States
CyberShot says

I just found this tutorial. looks pretty good and should cover all your questions

http://www.vooshthemes.com/blog/wordpress-tip/create-a-professional-portfolio-using-wordpress-3-0-custom-post-types/

by
by
by
by
by
by