wc_body_class( array $classes )
Add body classes for WC pages.
Description Description
Parameters Parameters
- $classes
-
(Required) Body Classes.
Return Return
(array)
Source Source
File: includes/wc-template-functions.php
function wc_body_class( $classes ) { $classes = (array) $classes; if ( is_woocommerce() ) { $classes[] = 'woocommerce'; $classes[] = 'woocommerce-page'; } elseif ( is_checkout() ) { $classes[] = 'woocommerce-checkout'; $classes[] = 'woocommerce-page'; } elseif ( is_cart() ) { $classes[] = 'woocommerce-cart'; $classes[] = 'woocommerce-page'; } elseif ( is_account_page() ) { $classes[] = 'woocommerce-account'; $classes[] = 'woocommerce-page'; } if ( is_store_notice_showing() ) { $classes[] = 'woocommerce-demo-store'; } foreach ( WC()->query->get_query_vars() as $key => $value ) { if ( is_wc_endpoint_url( $key ) ) { $classes[] = 'woocommerce-' . sanitize_html_class( $key ); } } $classes[] = 'woocommerce-no-js'; add_action( 'wp_footer', 'wc_no_js' ); return array_unique( $classes ); }