将此代码添加到我的。。神话元素/功能。php文件对我来说很有用:
/* Register Custom Post Type for Projects*/
add_action(\'init\', \'project_post_type_init\');
function project_post_type_init() {
$labels = array(
\'name\' => _x(\'My Projects\', \'post type general name\'),
\'singular_name\' => _x(\'Project\', \'post type singular name\'),
\'add_new\' => _x(\'Add New\', \'Project\'),
\'add_new_item\' => __(\'Add New Project\'),
\'edit_item\' => __(\'Edit Project\'),
\'new_item\' => __(\'New Project\'),
\'view_item\' => __(\'View Project\'),
\'search_items\' => __(\'Search Projects\'),
\'not_found\' => __(\'No Projects found\'),
\'not_found_in_trash\' => __(\'No Projects found in Trash\'),
\'parent_item_colon\' => __(\'Post\'),
\'parent\' => __(\'Post\'),
);
$args = array(
\'labels\' => $labels,
\'public\' => true,
\'publicly_queryable\' => true,
\'show_ui\' => true, //false - to hide from the admin area menu
\'rewrite\' => true,
\'query_var\' => true,
\'capability_type\' => \'post\',
\'hierarchical\' => true, //allow parent pages
\'show_in_nav_menus\' => false,
\'menu_position\' => 1000,
\'supports\' => array( \'title\', \'editor\', \'author\', \'thumbnail\', \'excerpt\', \'comments\', \'page-attributes\')
);
register_post_type(\'project\',$args);
}