Splitting the CSS #2785

This commit is contained in:
James Koster 2013-05-09 15:39:35 +01:00
parent 9ff21a9a84
commit b98307c4be
5 changed files with 25 additions and 6 deletions

View File

@ -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' => __( 'Styles and Scripts', 'woocommerce' ), 'type' => 'title', 'id' => 'script_styling_options' ),
array( array(
'title' => __( 'Styling', 'woocommerce' ), 'title' => __( 'Appearance', 'woocommerce' ),
'desc' => __( 'Enable WooCommerce CSS', 'woocommerce' ), 'desc' => __( 'Enable WooCommerce Appearance CSS', 'woocommerce' ),
'id' => 'woocommerce_frontend_css', 'id' => 'woocommerce_frontend_css',
'default' => 'yes', 'default' => 'yes',
'type' => 'checkbox' 'type' => 'checkbox'
), ),
array(
'title' => __( 'Layout', 'woocommerce' ),
'desc' => __( 'Enable WooCommerce Layout CSS', 'woocommerce' ),
'id' => 'woocommerce_frontend_css_layout',
'default' => 'yes',
'type' => 'checkbox'
),
array( array(
'type' => 'frontend_styles' 'type' => 'frontend_styles'
), ),

View File

View File

@ -0,0 +1 @@
// WooCommerce layout styles

View File

@ -166,6 +166,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
== Changelog == == Changelog ==
= 2.1 - x = = 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 - 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 - 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 * Tweak - Update CPT parameters for 'product_variation' and 'shop_coupon' to be no longer public

View File

@ -1224,14 +1224,23 @@ class Woocommerce {
wp_localize_script( 'woocommerce', 'woocommerce_params', apply_filters( 'woocommerce_params', $woocommerce_params ) ); wp_localize_script( 'woocommerce', 'woocommerce_params', apply_filters( 'woocommerce_params', $woocommerce_params ) );
// CSS Styles // 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'; $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 ); 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 );
}
} }
/** /**