diff --git a/wp-admin/menu.php b/wp-admin/menu.php index 94f479fb8c..ece6b59456 100644 --- a/wp-admin/menu.php +++ b/wp-admin/menu.php @@ -212,6 +212,12 @@ if ( wp_is_block_template_theme() ) { 'edit_theme_options', 'site-editor.php', ); + + $submenu['themes.php'][7] = array( + __( 'Styles' ), + 'edit_theme_options', + 'site-editor.php?styles=open', + ); } // Hide Customize link on block themes unless a plugin or theme is using diff --git a/wp-includes/admin-bar.php b/wp-includes/admin-bar.php index 6eca9d05b6..611c4e570b 100644 --- a/wp-includes/admin-bar.php +++ b/wp-includes/admin-bar.php @@ -408,6 +408,33 @@ function wp_admin_bar_site_menu( $wp_admin_bar ) { } } +/** + * Adds the "Edit site" link to the Toolbar. + * + * @since 5.9.0 + * + * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance. + */ +function wp_admin_bar_edit_site_menu( $wp_admin_bar ) { + // Don't show if a block theme is not activated. + if ( ! wp_is_block_template_theme() ) { + return; + } + + // Don't show for users who can't edit theme options or when in the admin. + if ( ! current_user_can( 'edit_theme_options' ) || is_admin() ) { + return; + } + + $wp_admin_bar->add_node( + array( + 'id' => 'site-editor', + 'title' => __( 'Edit site' ), + 'href' => admin_url( 'site-editor.php' ), + ) + ); +} + /** * Adds the "Customize" link to the Toolbar. * @@ -419,6 +446,11 @@ function wp_admin_bar_site_menu( $wp_admin_bar ) { function wp_admin_bar_customize_menu( $wp_admin_bar ) { global $wp_customize; + // Don't show if a block theme is activated. + if ( wp_is_block_template_theme() ) { + return; + } + // Don't show for users who can't access the customizer or when in the admin. if ( ! current_user_can( 'customize' ) || is_admin() ) { return; @@ -431,11 +463,6 @@ function wp_admin_bar_customize_menu( $wp_admin_bar ) { return; } - // Don't show if a block theme is activated. - if ( wp_is_block_template_theme() ) { - return; - } - $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; if ( is_customize_preview() && $wp_customize->changeset_uuid() ) { $current_url = remove_query_arg( 'customize_changeset_uuid', $current_url ); diff --git a/wp-includes/class-wp-admin-bar.php b/wp-includes/class-wp-admin-bar.php index 2d8814e590..6eab9c3fdb 100644 --- a/wp-includes/class-wp-admin-bar.php +++ b/wp-includes/class-wp-admin-bar.php @@ -642,6 +642,7 @@ class WP_Admin_Bar { add_action( 'admin_bar_menu', 'wp_admin_bar_wp_menu', 10 ); add_action( 'admin_bar_menu', 'wp_admin_bar_my_sites_menu', 20 ); add_action( 'admin_bar_menu', 'wp_admin_bar_site_menu', 30 ); + add_action( 'admin_bar_menu', 'wp_admin_bar_edit_site_menu', 40 ); add_action( 'admin_bar_menu', 'wp_admin_bar_customize_menu', 40 ); add_action( 'admin_bar_menu', 'wp_admin_bar_updates_menu', 50 ); diff --git a/wp-includes/post.php b/wp-includes/post.php index 8f3e6f6082..286ad8ccf6 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -340,7 +340,7 @@ function create_initial_post_types() { 'new_item' => __( 'New Template' ), 'edit_item' => __( 'Edit Template' ), 'view_item' => __( 'View Template' ), - 'all_items' => __( 'All Templates' ), + 'all_items' => __( 'Templates' ), 'search_items' => __( 'Search Templates' ), 'parent_item_colon' => __( 'Parent Template:' ), 'not_found' => __( 'No templates found.' ), @@ -356,8 +356,8 @@ function create_initial_post_types() { 'public' => false, '_builtin' => true, /* internal use only. don't use this when registering your own post type. */ 'has_archive' => false, - 'show_ui' => false, - 'show_in_menu' => false, + 'show_ui' => wp_is_block_template_theme(), + 'show_in_menu' => 'themes.php', 'show_in_rest' => true, 'rewrite' => false, 'rest_base' => 'templates', @@ -399,7 +399,7 @@ function create_initial_post_types() { 'new_item' => __( 'New Template Part' ), 'edit_item' => __( 'Edit Template Part' ), 'view_item' => __( 'View Template Part' ), - 'all_items' => __( 'All Template Parts' ), + 'all_items' => __( 'Template Parts' ), 'search_items' => __( 'Search Template Parts' ), 'parent_item_colon' => __( 'Parent Template Part:' ), 'not_found' => __( 'No template parts found.' ), @@ -415,8 +415,8 @@ function create_initial_post_types() { 'public' => false, '_builtin' => true, /* internal use only. don't use this when registering your own post type. */ 'has_archive' => false, - 'show_ui' => false, - 'show_in_menu' => false, + 'show_ui' => wp_is_block_template_theme(), + 'show_in_menu' => 'themes.php', 'show_in_rest' => true, 'rewrite' => false, 'rest_base' => 'template-parts', diff --git a/wp-includes/version.php b/wp-includes/version.php index 8f527c0b3c..5ce5496ce2 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '5.9-alpha-52157'; +$wp_version = '5.9-alpha-52158'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.