From b98307c4bef48cde27f1eebbc7435f74d6959921 Mon Sep 17 00:00:00 2001 From: James Koster Date: Thu, 9 May 2013 15:39:35 +0100 Subject: [PATCH] Splitting the CSS #2785 --- admin/settings/settings-init.php | 12 ++++++++++-- assets/css/woocommerce-layout.css | 0 assets/css/woocommerce-layout.less | 1 + readme.txt | 1 + woocommerce.php | 17 +++++++++++++---- 5 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 assets/css/woocommerce-layout.css create mode 100644 assets/css/woocommerce-layout.less diff --git a/admin/settings/settings-init.php b/admin/settings/settings-init.php index e1126c09c60..68486328646 100644 --- a/admin/settings/settings-init.php +++ b/admin/settings/settings-init.php @@ -201,13 +201,21 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings', array( 'title' => __( 'Styles and Scripts', 'woocommerce' ), 'type' => 'title', 'id' => 'script_styling_options' ), array( - 'title' => __( 'Styling', 'woocommerce' ), - 'desc' => __( 'Enable WooCommerce CSS', 'woocommerce' ), + 'title' => __( 'Appearance', 'woocommerce' ), + 'desc' => __( 'Enable WooCommerce Appearance CSS', 'woocommerce' ), 'id' => 'woocommerce_frontend_css', 'default' => 'yes', 'type' => 'checkbox' ), + array( + 'title' => __( 'Layout', 'woocommerce' ), + 'desc' => __( 'Enable WooCommerce Layout CSS', 'woocommerce' ), + 'id' => 'woocommerce_frontend_css_layout', + 'default' => 'yes', + 'type' => 'checkbox' + ), + array( 'type' => 'frontend_styles' ), diff --git a/assets/css/woocommerce-layout.css b/assets/css/woocommerce-layout.css new file mode 100644 index 00000000000..e69de29bb2d diff --git a/assets/css/woocommerce-layout.less b/assets/css/woocommerce-layout.less new file mode 100644 index 00000000000..d660e4b07d0 --- /dev/null +++ b/assets/css/woocommerce-layout.less @@ -0,0 +1 @@ +// WooCommerce layout styles \ No newline at end of file diff --git a/readme.txt b/readme.txt index d41e9e99de5..77256c1df84 100644 --- a/readme.txt +++ b/readme.txt @@ -166,6 +166,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc == Changelog == = 2.1 - x = +* Feature - Split frontend styles into separate appearance/layout stylesheets and added option for the new 'layout' stylesheet. * Tweak - Searching for SKU in admin panel can also be done via lowercase 'sku:' instead of just 'SKU:' * Tweak - Added filter to check the 'Create account' checkbox on checkout by default * Tweak - Update CPT parameters for 'product_variation' and 'shop_coupon' to be no longer public diff --git a/woocommerce.php b/woocommerce.php index e47caf04369..e99285b7c2b 100644 --- a/woocommerce.php +++ b/woocommerce.php @@ -1224,14 +1224,23 @@ class Woocommerce { wp_localize_script( 'woocommerce', 'woocommerce_params', apply_filters( 'woocommerce_params', $woocommerce_params ) ); // CSS Styles - if ( ! defined( 'WOOCOMMERCE_USE_CSS' ) ) - define( 'WOOCOMMERCE_USE_CSS', get_option( 'woocommerce_frontend_css' ) == 'yes' ? true : false ); - if ( WOOCOMMERCE_USE_CSS ) { + if ( ! defined( 'WOOCOMMERCE_USE_CSS_APPEARANCE' ) ) + define( 'WOOCOMMERCE_USE_CSS_APPEARANCE', get_option( 'woocommerce_frontend_css' ) == 'yes' ? true : false ); + + if ( ! defined( 'WOOCOMMERCE_USE_CSS_LAYOUT' ) ) + define( 'WOOCOMMERCE_USE_CSS_LAYOUT', get_option( 'woocommerce_frontend_css_layout' ) == 'yes' ? true : false ); + + if ( WOOCOMMERCE_USE_CSS_APPEARANCE && ! defined( 'WOOCOMMERCE_USE_CSS' ) ) { $css = file_exists( get_stylesheet_directory() . '/woocommerce/style.css' ) ? get_stylesheet_directory_uri() . '/woocommerce/style.css' : $this->plugin_url() . '/assets/css/woocommerce.css'; - wp_enqueue_style( 'woocommerce_frontend_styles', $css ); } + + if ( WOOCOMMERCE_USE_CSS_LAYOUT && ! defined( 'WOOCOMMERCE_USE_CSS' ) ) { + $css_layout = file_exists( get_stylesheet_directory() . '/woocommerce/style-layout.css' ) ? get_stylesheet_directory_uri() . '/woocommerce/style-layout.css' : $this->plugin_url() . '/assets/css/woocommerce-layout.css'; + wp_enqueue_style( 'woocommerce_frontend_styles_layout', $css_layout ); + } + } /**