834 posts
  • Power Elite Author: Sold more than $1M on Envato Market
  • Won a competition
  • Made it to the Authors' Hall of Fame
  • Has sold $1M+ on Envato Market and is now a Power Elite Author
+7 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
  • Has been part of the Envato Community for over 6 years
  • Has collected 1+ items on Envato Market
pauliewalnuts says

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

2 posts
  • Has been part of the Envato Community for over 6 years
  • Has collected 1+ items on Envato Market
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

4388 posts ThemeForest Reviewer
  • Has referred 1+ members
  • Has sold $40,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Member of the Envato Team
+12 more
Ivor Envato team 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
  • Has been part of the Envato Community for over 6 years
  • Has referred 1+ members
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
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/

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by