Skip to content

Commit 72925ef

Browse files
committed
Centralize check for default themes.
This should make Storefront appear in the Setup Wizard again.
1 parent 16868fe commit 72925ef

File tree

3 files changed

+24
-23
lines changed

3 files changed

+24
-23
lines changed

includes/admin/class-wc-admin-setup-wizard.php

+1-22
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function admin_menus() {
7373
* @return boolean
7474
*/
7575
protected function should_show_theme() {
76-
$support_woocommerce = current_theme_supports( 'woocommerce' ) && ! $this->is_default_theme();
76+
$support_woocommerce = current_theme_supports( 'woocommerce' ) && ! wc_is_wp_default_theme_active();
7777

7878
return (
7979
current_user_can( 'install_themes' ) &&
@@ -83,27 +83,6 @@ protected function should_show_theme() {
8383
);
8484
}
8585

86-
/**
87-
* Is the user using a default WP theme?
88-
*
89-
* @return boolean
90-
*/
91-
protected function is_default_theme() {
92-
return wc_is_active_theme(
93-
array(
94-
'twentynineteen',
95-
'twentyseventeen',
96-
'twentysixteen',
97-
'twentyfifteen',
98-
'twentyfourteen',
99-
'twentythirteen',
100-
'twentyeleven',
101-
'twentytwelve',
102-
'twentyten',
103-
)
104-
);
105-
}
106-
10786
/**
10887
* The "automated tax" extra should only be shown if the current user can
10988
* install plugins and the store is in a supported country.

includes/class-woocommerce.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ public function includes() {
478478
* @since 3.3.0
479479
*/
480480
private function theme_support_includes() {
481-
if ( wc_is_active_theme( array( 'twentytwenty', 'twentynineteen', 'twentyseventeen', 'twentysixteen', 'twentyfifteen', 'twentyfourteen', 'twentythirteen', 'twentyeleven', 'twentytwelve', 'twentyten' ) ) ) {
481+
if ( wc_is_wp_default_theme_active() ) {
482482
switch ( get_template() ) {
483483
case 'twentyten':
484484
include_once WC_ABSPATH . 'includes/theme-support/class-wc-twenty-ten.php';

includes/wc-core-functions.php

+22
Original file line numberDiff line numberDiff line change
@@ -2143,6 +2143,28 @@ function wc_is_active_theme( $theme ) {
21432143
return is_array( $theme ) ? in_array( get_template(), $theme, true ) : get_template() === $theme;
21442144
}
21452145

2146+
/**
2147+
* Is the user using a default WP theme?
2148+
*
2149+
* @return boolean
2150+
*/
2151+
function wc_is_wp_default_theme_active() {
2152+
return wc_is_active_theme(
2153+
array(
2154+
'twentytwenty',
2155+
'twentynineteen',
2156+
'twentyseventeen',
2157+
'twentysixteen',
2158+
'twentyfifteen',
2159+
'twentyfourteen',
2160+
'twentythirteen',
2161+
'twentyeleven',
2162+
'twentytwelve',
2163+
'twentyten',
2164+
)
2165+
);
2166+
}
2167+
21462168
/**
21472169
* Cleans up session data - cron callback.
21482170
*

0 commit comments

Comments
 (0)