From e25cbb1f876c49c6d0e03e0e96005c743ac5608b Mon Sep 17 00:00:00 2001 From: Ilyas Foo Date: Wed, 18 Oct 2023 10:18:08 +0800 Subject: [PATCH] Add active theme label to intro screen (#40824) * Add detect of current theme for active theme label * Lint I have, master Yoda * Changelog --- .../woocommerce/changelog/add-40794-active-theme-label | 4 ++++ plugins/woocommerce/src/Admin/API/OnboardingThemes.php | 10 ++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 plugins/woocommerce/changelog/add-40794-active-theme-label diff --git a/plugins/woocommerce/changelog/add-40794-active-theme-label b/plugins/woocommerce/changelog/add-40794-active-theme-label new file mode 100644 index 00000000000..f4a962b357c --- /dev/null +++ b/plugins/woocommerce/changelog/add-40794-active-theme-label @@ -0,0 +1,4 @@ +Significance: minor +Type: update + +Add active theme label for CYS intro screen diff --git a/plugins/woocommerce/src/Admin/API/OnboardingThemes.php b/plugins/woocommerce/src/Admin/API/OnboardingThemes.php index 05676f5d67d..97fbf490b2a 100644 --- a/plugins/woocommerce/src/Admin/API/OnboardingThemes.php +++ b/plugins/woocommerce/src/Admin/API/OnboardingThemes.php @@ -249,6 +249,8 @@ class OnboardingThemes extends \WC_REST_Data_Controller { ); } + $current_theme_slug = wp_get_theme()->get_stylesheet(); + // To be implemented: 1. Fetch themes from the marketplace API. 2. Convert prices to the requested currency. // These are Dotcom themes. $themes = array( @@ -258,7 +260,7 @@ class OnboardingThemes extends \WC_REST_Data_Controller { 'color_palettes' => array(), 'total_palettes' => 0, 'slug' => 'tsubaki', - 'is_active' => false, + 'is_active' => 'tsubaki' === $current_theme_slug, 'thumbnail_url' => 'https://i0.wp.com/s2.wp.com/wp-content/themes/premium/tsubaki/screenshot.png', 'link_url' => 'https://wordpress.com/theme/tsubaki/', ), @@ -268,7 +270,7 @@ class OnboardingThemes extends \WC_REST_Data_Controller { 'color_palettes' => array(), 'total_palettes' => 0, 'slug' => 'tazza', - 'is_active' => false, + 'is_active' => 'tazza' === $current_theme_slug, 'thumbnail_url' => 'https://i0.wp.com/s2.wp.com/wp-content/themes/premium/tazza/screenshot.png', 'link_url' => 'https://wordpress.com/theme/tazza/', 'total_palettes' => 0, @@ -300,7 +302,7 @@ class OnboardingThemes extends \WC_REST_Data_Controller { ), 'total_palettes' => 5, 'slug' => 'amulet', - 'is_active' => false, + 'is_active' => 'amulet' === $current_theme_slug, 'thumbnail_url' => 'https://i0.wp.com/s2.wp.com/wp-content/themes/premium/amulet/screenshot.png', 'link_url' => 'https://wordpress.com/theme/amulet/', ), @@ -331,7 +333,7 @@ class OnboardingThemes extends \WC_REST_Data_Controller { ), 'total_palettes' => 11, 'slug' => 'zaino', - 'is_active' => false, + 'is_active' => 'zaino' === $current_theme_slug, 'thumbnail_url' => 'https://i0.wp.com/s2.wp.com/wp-content/themes/premium/zaino/screenshot.png', 'link_url' => 'https://wordpress.com/theme/zaino/', ),