我从我制作的另一个使用层次结构的网站上获取了这一信息,它很有效。(我已修改以适合您的职位类型)
function register_publications_cpt() {
$labels = array(
\'name\' => _x(\'Publications\', \'post type general name\'),
\'singular_name\' => _x(\'Publication\', \'post type singular name\'),
\'add_new\' => _x(\'Add New\', \'\'),
\'add_new_item\' => __(\'Add New Publication\'),
\'edit_item\' => __(\'Edit Publication\'),
\'new_item\' => __(\'New Publication\'),
\'all_items\' => __(\'All Publication\'),
\'view_item\' => __(\'View Publication\'),
\'search_items\' => __(\'Search Publications\'),
\'not_found\' => __(\'No Publications found\'),
\'not_found_in_trash\' => __(\'No Publications found in Trash\'),
\'parent_item_colon\' => \'\',
\'menu_name\' => \'Publications\'
);
$args = array(
\'hierarchical\' => true,
\'labels\' => $labels,
\'public\' => true,
\'publicly_queryable\' => true,
\'show_ui\' => true,
\'show_in_menu\' => true,
\'query_var\' => true,
\'rewrite\' => true,
\'capability_type\' => \'page\',
\'has_archive\' => false,
\'menu_position\' => 22,
\'supports\' => array( \'title\', \'editor\', \'author\', \'thumbnail\', \'revisions\', \'page-attributes\', \'custom-fields\' )
);
register_post_type(\'publication\', $args);
}
add_action(\'init\', \'register_publications_cpt\');