使用CPT UI创建名为"Resource"的自定义文章类型:
// functions.php
function create_resource_post_type() {
register_post_type('resource',
array(
'labels' => array(
'name' => __('Resources'),
'singular_name' => __('Resource')
),
'public' => true,
'has_archive' => true,
'show_in_rest' => true,
'supports' => array('title', 'editor', 'thumbnail', 'excerpt'),
)
);
}
add_action('init', 'create_resource_post_type');