From 9b9366c67521aa4f128894dfc1f7efeb0ff4875f Mon Sep 17 00:00:00 2001 From: James Collins Date: Thu, 19 Apr 2012 17:14:48 +1000 Subject: [PATCH 1/2] Body Classes should be sanitised Correctly add the current theme's name to the 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. --- woocommerce.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/woocommerce.php b/woocommerce.php index f300dd83747..54761377f79 100644 --- a/woocommerce.php +++ b/woocommerce.php @@ -424,7 +424,7 @@ class Woocommerce { * Add body classes **/ 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'); @@ -1354,7 +1354,7 @@ class Woocommerce { /** Body Classes **********************************************************/ function add_body_class( $class ) { - $this->_body_classes[] = $class; + $this->_body_classes[] = sanitize_html_class( strtolower($class) ); } function output_body_class( $classes ) { From 266ced3d18ca5601fd1ebfe4385f309507aab55a Mon Sep 17 00:00:00 2001 From: James Collins Date: Thu, 19 Apr 2012 17:50:28 +1000 Subject: [PATCH 2/2] Add body class fix to readme --- readme.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.txt b/readme.txt index 885fcecb06b..431f27a650c 100644 --- a/readme.txt +++ b/readme.txt @@ -147,6 +147,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc * Tweak - Added minus symbol before discount on view order page * Tweak - Added yards as dimensions unit * Fix - Replacing use of deprecated function get_current_theme() with wp_get_theme() +* Fix - Body classes now correct for WordPress themes with non alphanumeric characters * Fix - PayPal http_build_query & -> & on some PHP 5.3 servers * Fix - update_count_callback for tags * Localization - Slovak translation by Dušan Beleščák