diff --git a/plugins/woocommerce/changelog/51147-30050 b/plugins/woocommerce/changelog/51147-30050 new file mode 100644 index 00000000000..1c94e59a7c8 --- /dev/null +++ b/plugins/woocommerce/changelog/51147-30050 @@ -0,0 +1,4 @@ +Significance: minor +Type: enhancement + +Add additional body class for the account dashboard \ No newline at end of file diff --git a/plugins/woocommerce/includes/wc-template-functions.php b/plugins/woocommerce/includes/wc-template-functions.php index 5b804e25533..10a4ebdc563 100644 --- a/plugins/woocommerce/includes/wc-template-functions.php +++ b/plugins/woocommerce/includes/wc-template-functions.php @@ -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() ) {