From 2874c2e164669143dc3dea068b108ea8584e6a3d Mon Sep 17 00:00:00 2001 From: Miguel Torres <1233880+mmtr@users.noreply.github.com> Date: Wed, 17 Apr 2024 11:43:15 +0200 Subject: [PATCH] Admin menu: Fix "Appearance > Themes" menu for WP.com classic sites (#36934) --- .../jetpack-mu-wpcom/changelog/fix-theme-showcase-menu | 4 ++++ .../src/features/wpcom-themes/wpcom-themes.php | 5 ----- projects/plugins/jetpack/changelog/fix-theme-showcase-menu | 5 +++++ .../modules/masterbar/admin-menu/class-admin-menu.php | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 projects/packages/jetpack-mu-wpcom/changelog/fix-theme-showcase-menu create mode 100644 projects/plugins/jetpack/changelog/fix-theme-showcase-menu diff --git a/projects/packages/jetpack-mu-wpcom/changelog/fix-theme-showcase-menu b/projects/packages/jetpack-mu-wpcom/changelog/fix-theme-showcase-menu new file mode 100644 index 0000000000000..5639cf0d1175d --- /dev/null +++ b/projects/packages/jetpack-mu-wpcom/changelog/fix-theme-showcase-menu @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Fixed a WP.com only issue that forced the Themes menu to always point to Calypso even when the classic interface was set diff --git a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-themes/wpcom-themes.php b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-themes/wpcom-themes.php index bbb6ffcf38000..2de09536330bb 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-themes/wpcom-themes.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-themes/wpcom-themes.php @@ -60,11 +60,6 @@ function wpcom_themes_add_theme_showcase_menu() { return; } - // Bail on Simple sites, since "Appearance > Themes" already links to the Theme Showcase on those. - if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) { - return; - } - $site_slug = wp_parse_url( home_url(), PHP_URL_HOST ); add_submenu_page( 'themes.php', esc_attr__( 'Theme Showcase', 'jetpack-mu-wpcom' ), __( 'Theme Showcase', 'jetpack-mu-wpcom' ), 'read', "https://wordpress.com/themes/$site_slug?ref=wpcom-themes-menu" ); } diff --git a/projects/plugins/jetpack/changelog/fix-theme-showcase-menu b/projects/plugins/jetpack/changelog/fix-theme-showcase-menu new file mode 100644 index 0000000000000..14ca9a60575f8 --- /dev/null +++ b/projects/plugins/jetpack/changelog/fix-theme-showcase-menu @@ -0,0 +1,5 @@ +Significance: patch +Type: other +Comment: Fixed a WP.com only issue that forced the Themes menu to always point to Calypso even when the classic interface was set + + diff --git a/projects/plugins/jetpack/modules/masterbar/admin-menu/class-admin-menu.php b/projects/plugins/jetpack/modules/masterbar/admin-menu/class-admin-menu.php index 4909fe43ea743..14812aecfc5bb 100644 --- a/projects/plugins/jetpack/modules/masterbar/admin-menu/class-admin-menu.php +++ b/projects/plugins/jetpack/modules/masterbar/admin-menu/class-admin-menu.php @@ -290,7 +290,7 @@ public function add_appearance_menu() { $default_customize_background_slug_2 => add_query_arg( array( 'autofocus' => array( 'section' => 'colors_manager_tool' ) ), $customize_url ), ); - if ( self::DEFAULT_VIEW === $this->get_preferred_view( 'themes.php' ) || self::CLASSIC_VIEW === $this->get_preferred_view( 'themes.php' ) ) { + if ( self::DEFAULT_VIEW === $this->get_preferred_view( 'themes.php' ) ) { $submenus_to_update['themes.php'] = 'https://wordpress.com/themes/' . $this->domain; }