Body Classes should be sanitised
Correctly add the current theme's name to the <body> classes. Previously, theme names that contain spaces and other strange characters would cause problems. Also ensure that any other body classes that WooCommerce adds are also sanitised.
This commit is contained in:
parent
727a4b1cf4
commit
9b9366c675
|
@ -424,7 +424,7 @@ class Woocommerce {
|
||||||
* Add body classes
|
* Add body classes
|
||||||
**/
|
**/
|
||||||
function wp_head() {
|
function wp_head() {
|
||||||
$this->add_body_class('theme-' . strtolower( get_current_theme() ));
|
$this->add_body_class('theme-' . get_current_theme() );
|
||||||
|
|
||||||
if ( is_woocommerce() ) $this->add_body_class('woocommerce');
|
if ( is_woocommerce() ) $this->add_body_class('woocommerce');
|
||||||
|
|
||||||
|
@ -1354,7 +1354,7 @@ class Woocommerce {
|
||||||
/** Body Classes **********************************************************/
|
/** Body Classes **********************************************************/
|
||||||
|
|
||||||
function add_body_class( $class ) {
|
function add_body_class( $class ) {
|
||||||
$this->_body_classes[] = $class;
|
$this->_body_classes[] = sanitize_html_class( strtolower($class) );
|
||||||
}
|
}
|
||||||
|
|
||||||
function output_body_class( $classes ) {
|
function output_body_class( $classes ) {
|
||||||
|
|
Loading…
Reference in New Issue