From c16ad4e876b4aba119b2cf698eafaad9d6047d30 Mon Sep 17 00:00:00 2001 From: Robert Anderson Date: Fri, 28 May 2021 15:19:02 +1000 Subject: [PATCH 1/4] Link to widgets.php instead of themes.php?page=gutenberg-widgets --- lib/init.php | 17 +++++++++++++---- .../src/components/sidebar/widget-areas.js | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/init.php b/lib/init.php index e22542766f87ed..bdabb0917271ff 100644 --- a/lib/init.php +++ b/lib/init.php @@ -30,7 +30,10 @@ function gutenberg_menu() { 'gutenberg' ); - if ( gutenberg_use_widgets_block_editor() ) { + if ( + gutenberg_use_widgets_block_editor() && + ! function_exists( 'wp_use_widgets_block_editor' ) + ) { add_theme_page( __( 'Widgets', 'gutenberg' ), __( 'Widgets', 'gutenberg' ), @@ -113,7 +116,11 @@ function gutenberg_site_editor_menu() { * @param WP_Admin_Bar $wp_admin_bar Core class used to implement the Toolbar API. */ function modify_admin_bar( $wp_admin_bar ) { - if ( gutenberg_use_widgets_block_editor() && $wp_admin_bar->get_node( 'widgets' ) !== null ) { + if ( + gutenberg_use_widgets_block_editor() && + ! function_exists( 'wp_use_widgets_block_editor' ) && + $wp_admin_bar->get_node( 'widgets' ) !== null + ) { $wp_admin_bar->add_menu( array( 'id' => 'widgets', @@ -137,7 +144,10 @@ function modify_welcome_panel() { ob_start(); wp_welcome_panel(); $welcome_panel = ob_get_clean(); - if ( gutenberg_use_widgets_block_editor() ) { + if ( + gutenberg_use_widgets_block_editor() && + ! function_exists( 'wp_use_widgets_block_editor' ) + ) { echo str_replace( admin_url( 'widgets.php' ), admin_url( 'themes.php?page=gutenberg-widgets' ), @@ -177,5 +187,4 @@ function register_site_icon_url( $response ) { add_filter( 'rest_index', 'register_site_icon_url' ); -add_theme_support( 'widgets-block-editor' ); add_theme_support( 'block-templates' ); diff --git a/packages/edit-widgets/src/components/sidebar/widget-areas.js b/packages/edit-widgets/src/components/sidebar/widget-areas.js index 781c644f13ba09..947254f3e115c3 100644 --- a/packages/edit-widgets/src/components/sidebar/widget-areas.js +++ b/packages/edit-widgets/src/components/sidebar/widget-areas.js @@ -59,7 +59,7 @@ export default function WidgetAreas( { selectedWidgetAreaId } ) {