๐Ÿ”ž ADULT: Changeset/ - Collection

Changeset 59698


Ignore:
Timestamp:
01/24/2025 10:56:38 AM (11 months ago)
Author:
audrasjb
Message:

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.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/admin-header.php

    r59678 r59698 ย 
    213213if ( $current_screen->is_block_editor() ) {
    214214    $admin_body_class .= ' block-editor-page wp-embed-responsive';
    ย 215}
    ย 216
    ย 217$admin_body_class .= ' wp-theme-' . sanitize_html_class( get_template() );
    ย 218if ( is_child_theme() ) {
    ย 219    $admin_body_class .= ' wp-child-theme-' . sanitize_html_class( get_stylesheet() );
    215220}
    216221
  • trunk/src/wp-includes/post-template.php

    r59689 r59698 ย 
    837837            $classes[] = 'post-type-paged-' . $page;
    838838        }
    ย 839    }
    ย 840
    ย 841    $classes[] = 'wp-theme-' . sanitize_html_class( get_template() );
    ย 842    if ( is_child_theme() ) {
    ย 843        $classes[] = 'wp-child-theme-' . sanitize_html_class( get_stylesheet() );
    839844    }
    840845
Note: See TracChangeset for help on using the changeset viewer.