admin管理员组文章数量:1313790
I'm trying to create a custom post type that I can associate with parent posts (they are posts not pages). Wordpress is version 3.0.1. I was hoping to see a list of posts in a parent post drop-down under Page-Attributes but all I get its an 'Order' field. Have I missed something vital?
register_post_type( 'mytest_post_type',
array(
'labels' => array(
'name' => __( 'mytest Interviews' ),
'singular_name' => __( 'mytest Interview' ),
'add_new' => __( 'Add New' ),
'add_new_item' => __( 'Add New mytest Interview' ),
'edit' => __( 'Edit' ),
'edit_item' => __( 'Edit mytest Interview' ),
'new_item' => __( 'New mytest Int.' ),
'view' => __( 'View mytest Inteview' ),
'view_item' => __( 'View mytest Int.' ),
'search_items' => __( 'Search mytest Interviews' ),
'not_found' => __( 'No mytest Interviews found' ),
'not_found_in_trash' => __( 'No mytest Interviews found in Trash' ),
'parent' => __( 'Parent mytest Interview' ),
),
'public' => true,
'show_ui' => true,
'hierarchical' => true,
'query_var' => true,
'supports' => array('title', 'editor', 'author','custom-fields','page-attributes'),
)
);
Or is it not possible to create a new custom post type and have those new posts be children of existing posts?
thanks!
I'm trying to create a custom post type that I can associate with parent posts (they are posts not pages). Wordpress is version 3.0.1. I was hoping to see a list of posts in a parent post drop-down under Page-Attributes but all I get its an 'Order' field. Have I missed something vital?
register_post_type( 'mytest_post_type',
array(
'labels' => array(
'name' => __( 'mytest Interviews' ),
'singular_name' => __( 'mytest Interview' ),
'add_new' => __( 'Add New' ),
'add_new_item' => __( 'Add New mytest Interview' ),
'edit' => __( 'Edit' ),
'edit_item' => __( 'Edit mytest Interview' ),
'new_item' => __( 'New mytest Int.' ),
'view' => __( 'View mytest Inteview' ),
'view_item' => __( 'View mytest Int.' ),
'search_items' => __( 'Search mytest Interviews' ),
'not_found' => __( 'No mytest Interviews found' ),
'not_found_in_trash' => __( 'No mytest Interviews found in Trash' ),
'parent' => __( 'Parent mytest Interview' ),
),
'public' => true,
'show_ui' => true,
'hierarchical' => true,
'query_var' => true,
'supports' => array('title', 'editor', 'author','custom-fields','page-attributes'),
)
);
Or is it not possible to create a new custom post type and have those new posts be children of existing posts?
thanks!
Share Improve this question asked Oct 7, 2010 at 10:48 codecowboycodecowboy 1,7786 gold badges23 silver badges43 bronze badges2 Answers
Reset to default 5This works for me. Looking at the code, the dropdown only appears if the post type is hierarchical (which is true in your case), and if there are other posts of the same type in the database. So a post can not be a child of another post type (a regular post or page for example), and the first new post of a type will not show the dropdown menu.
make sure you include this three property in your rregister_post_type argument
'supports' => [ 'title', 'editor', 'excerpt', 'thumbnail','custom-fields','page-attributes', ],
'hierarchical' => true,
'capability_type' => 'page',
本文标签: Parent dropdown not appearing for custom post type
版权声明:本文标题:Parent drop-down not appearing for custom post type 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741940269a2406101.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论