Add additional body class for the account dashboard (#30050) (#51147)

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Nestor Soriano <konamiman@konamiman.com>
This commit is contained in:
David Allsop 2024-09-20 10:21:33 +01:00 committed by GitHub
parent 9c58f198cf
commit ad2d18200f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 0 deletions

View File

@ -0,0 +1,4 @@
Significance: minor
Type: enhancement
Add additional body class for the account dashboard

View File

@ -299,6 +299,9 @@ function wc_generator_tag( $gen, $type ) {
* @return array
*/
function wc_body_class( $classes ) {
global $wp;
$classes = (array) $classes;
if ( is_shop() ) {
@ -327,6 +330,11 @@ function wc_body_class( $classes ) {
$classes[] = 'woocommerce-account';
$classes[] = 'woocommerce-page';
$account_page_id = get_option( 'woocommerce_myaccount_page_id' );
if ( ! empty( $account_page_id ) && ( get_post_field( 'post_name', $account_page_id ) === basename( $wp->request ) && is_user_logged_in() ) ) {
$classes[] = 'woocommerce-dashboard';
}
}
if ( is_store_notice_showing() ) {