mirror of
git://develop.git.wordpress.org/
synced 2025-03-24 22:10:02 +01:00
Themes: Add wp-theme-<name>
and wp-child-theme-<name>
classes to body_class
.
This changeset introduces new classes to the body tag. The classes `wp-theme-<name>` and `wp-child-theme-<name>` (when the current theme is a child theme) are added, where `<name>` represents the sanitized name of the active theme. Props cais, GaryJ, nacin, SergeyBiryukov, johnjamesjacoby, nirajgirixd, poena, audrasjb, rinkalpagdar. Fixes #19736. git-svn-id: https://develop.svn.wordpress.org/trunk@59698 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
530e8fda5d
commit
0f6707de30
@ -214,6 +214,11 @@ if ( $current_screen->is_block_editor() ) {
|
||||
$admin_body_class .= ' block-editor-page wp-embed-responsive';
|
||||
}
|
||||
|
||||
$admin_body_class .= ' wp-theme-' . sanitize_html_class( get_template() );
|
||||
if ( is_child_theme() ) {
|
||||
$admin_body_class .= ' wp-child-theme-' . sanitize_html_class( get_stylesheet() );
|
||||
}
|
||||
|
||||
$error_get_last = error_get_last();
|
||||
|
||||
// Print a CSS class to make PHP errors visible.
|
||||
|
@ -838,6 +838,11 @@ function get_body_class( $css_class = '' ) {
|
||||
}
|
||||
}
|
||||
|
||||
$classes[] = 'wp-theme-' . sanitize_html_class( get_template() );
|
||||
if ( is_child_theme() ) {
|
||||
$classes[] = 'wp-child-theme-' . sanitize_html_class( get_stylesheet() );
|
||||
}
|
||||
|
||||
if ( ! empty( $css_class ) ) {
|
||||
if ( ! is_array( $css_class ) ) {
|
||||
$css_class = preg_split( '#\s+#', $css_class );
|
||||
|
Loading…
x
Reference in New Issue
Block a user