Skip to content

Commit 9096c26

Browse files
committed
Fix class name
1 parent 24e7111 commit 9096c26

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

dist/cms.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,24 @@ function usesBlockTheme() {
1313
*/
1414
function getWordPressTheme() {
1515
const theme = {
16-
theme: 'unknown',
17-
parent_theme: '',
16+
theme: '',
17+
child_theme: '',
1818
};
1919
try {
2020
const bodyClass = document.body.classList;
2121

2222
const parentTheme = Array.from( bodyClass ).find( c => c.startsWith( 'wp-theme-' ) );
23+
24+
if ( parentTheme ) {
25+
theme.theme = parentTheme.replace( 'wp-theme-', '' );
26+
}
27+
2328
const childTheme = Array.from( bodyClass ).find( c => c.startsWith( 'wp-child-theme-' ) );
2429

2530
if ( childTheme ) {
26-
theme.theme = childTheme;
27-
28-
// If there is a child theme, there should always be a parent theme.
29-
if ( parentTheme ) {
30-
theme.parent_theme = parentTheme;
31-
}
32-
} else if ( parentTheme ) {
33-
// There is no child theme, only a parent theme.
34-
theme.theme = parentTheme;
31+
theme.child_theme = childTheme.replace( 'wp-child-theme-', '' );
3532
}
33+
3634
} catch ( e ) {}
3735
return theme;
3836
}

0 commit comments

Comments
 (0)