Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this questionhow can i add a parent post to my custom post type ?
I found an example :
function codex_custom_init() {
// Our People
$people_label = array(
'name' => 'People',
'singular_name' => 'People',
'add_new' => 'Add People',
'add_new_item' => 'Add New People',
'edit_item' => 'Edit People',
'new_item' => 'New People',
'all_items' => 'All People',
'view_item' => 'View People',
'search_items' => 'Search People',
'not_found' => 'No People found',
'not_found_in_trash' => 'No People found in Trash',
'parent_item_colon' => '',
'menu_name' => 'People',
);
$people_args = array (
'labels' => $people_label,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'our-people'),
'capability_type' => 'page',
'has_archive' => true,
'hierarchical' => true,
'menu_position' => null,
'menu_icon' => get_template_directory_uri() . '/images/icons/people.png',
'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt','page-attributes'),
);
register_post_type('people', $people_args);}
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this questionhow can i add a parent post to my custom post type ?
I found an example :
function codex_custom_init() {
// Our People
$people_label = array(
'name' => 'People',
'singular_name' => 'People',
'add_new' => 'Add People',
'add_new_item' => 'Add New People',
'edit_item' => 'Edit People',
'new_item' => 'New People',
'all_items' => 'All People',
'view_item' => 'View People',
'search_items' => 'Search People',
'not_found' => 'No People found',
'not_found_in_trash' => 'No People found in Trash',
'parent_item_colon' => '',
'menu_name' => 'People',
);
$people_args = array (
'labels' => $people_label,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'our-people'),
'capability_type' => 'page',
'has_archive' => true,
'hierarchical' => true,
'menu_position' => null,
'menu_icon' => get_template_directory_uri() . '/images/icons/people.png',
'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt','page-attributes'),
);
register_post_type('people', $people_args);}
Setting the hierarchical
property of the post type to true
let’s you set parent posts for them:
'hierarchical' => true,