Make WordPress Core


Ignore:
Timestamp:
05/25/2021 02:19:14 PM (4 years ago)
Author:
youknowriad
Message:

Block Editor: Introduce block templates for classic themes.

With this patch, users will be able to create custom block based templates
and assign them to specific pages/posts.

Themes can also opt-out of this feature

Props bernhard-reiter, carlomanf.
Fixes #53176.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/post.php

    r50935 r51003  
    305305            'supports'              => array(
    306306                'title',
     307                'editor',
     308                'revisions',
     309            ),
     310        )
     311    );
     312
     313    register_post_type(
     314        'wp_template',
     315        array(
     316            'labels'                => array(
     317                'name'                  => __( 'Templates' ),
     318                'singular_name'         => __( 'Template' ),
     319                'menu_name'             => _x( 'Templates', 'Admin Menu text' ),
     320                'add_new'               => _x( 'Add New', 'Template' ),
     321                'add_new_item'          => __( 'Add New Template' ),
     322                'new_item'              => __( 'New Template' ),
     323                'edit_item'             => __( 'Edit Template' ),
     324                'view_item'             => __( 'View Template' ),
     325                'all_items'             => __( 'All Templates' ),
     326                'search_items'          => __( 'Search Templates' ),
     327                'parent_item_colon'     => __( 'Parent Template:' ),
     328                'not_found'             => __( 'No templates found.' ),
     329                'not_found_in_trash'    => __( 'No templates found in Trash.' ),
     330                'archives'              => __( 'Template archives' ),
     331                'insert_into_item'      => __( 'Insert into template' ),
     332                'uploaded_to_this_item' => __( 'Uploaded to this template' ),
     333                'filter_items_list'     => __( 'Filter templates list' ),
     334                'items_list_navigation' => __( 'Templates list navigation' ),
     335                'items_list'            => __( 'Templates list' ),
     336            ),
     337            'description'           => __( 'Templates to include in your theme.' ),
     338            'public'                => false,
     339            'has_archive'           => false,
     340            'show_ui'               => false,
     341            'show_in_menu'          => false,
     342            'show_in_admin_bar'     => false,
     343            'show_in_rest'          => true,
     344            'rewrite'               => false,
     345            'rest_base'             => 'templates',
     346            'rest_controller_class' => 'WP_REST_Templates_Controller',
     347            'capability_type'       => array( 'template', 'templates' ),
     348            'capabilities'          => array(
     349                'create_posts'           => 'edit_theme_options',
     350                'delete_posts'           => 'edit_theme_options',
     351                'delete_others_posts'    => 'edit_theme_options',
     352                'delete_private_posts'   => 'edit_theme_options',
     353                'delete_published_posts' => 'edit_theme_options',
     354                'edit_posts'             => 'edit_theme_options',
     355                'edit_others_posts'      => 'edit_theme_options',
     356                'edit_private_posts'     => 'edit_theme_options',
     357                'edit_published_posts'   => 'edit_theme_options',
     358                'publish_posts'          => 'edit_theme_options',
     359                'read'                   => 'edit_theme_options',
     360                'read_private_posts'     => 'edit_theme_options',
     361            ),
     362            'map_meta_cap'          => true,
     363            'supports'              => array(
     364                'title',
     365                'slug',
     366                'excerpt',
    307367                'editor',
    308368                'revisions',
Note: See TracChangeset for help on using the changeset viewer.