我通过在“管理”菜单中创建了一个帖子类型
function codex_custom_init() {
$labels = array(
\'name\' => _x( \'Book\', \'post type general name\', \'your-plugin-textdomain\' ),
\'singular_name\' => _x( \'Book\', \'post type singular name\', \'your-plugin-textdomain\' ),
\'menu_name\' => _x( \'Books\', \'admin menu\', \'your-plugin-textdomain\' ),
\'name_admin_bar\' => _x( \'Books\', \'add new on admin bar\', \'your-plugin-textdomain\' ),
\'add_new\' => _x( \'add Books\', \'book\', \'your-plugin-textdomain\' ),
\'add_new_item\' => __( \'add Books\', \'your-plugin-textdomain\' ),
\'new_item\' => __( \'add Books\', \'your-plugin-textdomain\' ),
\'edit_item\' => __( \'add Books\', \'your-plugin-textdomain\' ),
\'view_item\' => __( \'add Books\', \'your-plugin-textdomain\' ),
\'all_items\' => __( \'add Books\', \'your-plugin-textdomain\' ),
\'search_items\' => __( \'Seite suchen\', \'your-plugin-textdomain\' ),
\'parent_item_colon\' => __( \'Parent Seiten:\', \'your-plugin-textdomain\' ),
\'not_found\' => __( \'No Books.\', \'your-plugin-textdomain\' ),
\'not_found_in_trash\' => __( \'No Books.\', \'your-plugin-textdomain\' ),
\'archives\' => __( \'Books Archiv\' ),
\'attributes\' => __( \'Books Attribute\' ),
\'insert_into_item\' => __( \'add Books\' ),
\'uploaded_to_this_item\' => __( \'upload Books\' ),
\'page\' => get_stylesheet_directory_uri().\'/template-test.php\',
\'capabilities\' => array(
\'edit_post\' => \'edit_Books\',
\'read_post\' => \'read_Books\',
\'delete_post\' => \'delete_Books\',
\'delete_posts\' => \'delete_Books\',
\'edit_posts\' => \'edit_Books\',
\'edit_others_posts\' => \'edit_others_Books\',
\'publish_posts\' => \'publish_Books\',
\'read_private_posts\' => \'read_private_Books\',
\'create_posts\' => \'create_Books\',),);
$args = array(
\'labels\' => $labels,
\'description\' => __( \'Description.\', \'your-plugin-textdomain\' ),
\'public\' => false,
\'publicly_queryable\' => false,
\'show_ui\' => true,
\'show_in_menu\' => true,
\'query_var\' => true,
\'rewrite\' => array( \'slug\' => \'maths\' ),
\'has_archive\' => true,
\'hierarchical\' => false,
\'menu_position\' => 20,
\'menu_icon\' => \'dashicons-welcome-learn-more\',
\'hierarchical\' => true,
\'supports\' => array( \'title\', \'editor\', \'author\', \'thumbnail\', \'excerpt\', \'comments\', \'custom-fields\',\'revisions\', \'page-attributes\', \'post-formats\'),
\'post_type\' => \'events\',
\'posts_per_page\' => 10,
);
register_post_type( \'Books\', $args );}}
add_action( \'init\', \'codex_custom_init\' );
我意识到我不能在页面属性中使用“模板”功能。它仅在“页面”类别中可用,但在我创建的帖子类型中不可用。缺少此项:
有人知道我如何提供吗?非常感谢。