2016-01-20 16:02:53 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Storefront Customizer Class
|
|
|
|
*
|
|
|
|
* @author WooThemes
|
2016-02-19 16:57:56 +00:00
|
|
|
* @package storefront
|
2016-01-20 16:02:53 +00:00
|
|
|
* @since 2.0.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( ! class_exists( 'Storefront_Customizer' ) ) :
|
|
|
|
|
|
|
|
/**
|
2016-02-19 16:57:56 +00:00
|
|
|
* The Storefront Customizer class
|
2016-01-20 16:02:53 +00:00
|
|
|
*/
|
2016-02-19 16:57:56 +00:00
|
|
|
class Storefront_Customizer {
|
2016-01-20 16:02:53 +00:00
|
|
|
|
|
|
|
/**
|
2016-02-19 16:57:56 +00:00
|
|
|
* Setup class.
|
|
|
|
*
|
|
|
|
* @since 1.0
|
2016-01-20 16:02:53 +00:00
|
|
|
*/
|
2016-02-19 16:57:56 +00:00
|
|
|
public function __construct() {
|
2016-03-03 13:27:26 +00:00
|
|
|
add_action( 'customize_register', array( $this, 'customize_register' ), 10 );
|
|
|
|
add_filter( 'body_class', array( $this, 'layout_class' ) );
|
|
|
|
add_action( 'wp_enqueue_scripts', array( $this, 'add_customizer_css' ), 130 );
|
|
|
|
add_action( 'after_setup_theme', array( $this, 'custom_header_setup' ) );
|
|
|
|
add_action( 'customize_controls_print_styles', array( $this, 'customizer_custom_control_css' ) );
|
2016-05-10 15:59:49 +01:00
|
|
|
add_action( 'customize_register', array( $this, 'edit_default_customizer_settings' ), 99 );
|
2016-03-03 13:27:26 +00:00
|
|
|
add_action( 'init', array( $this, 'default_theme_mod_values' ), 10 );
|
2016-03-16 14:15:39 +00:00
|
|
|
|
|
|
|
add_action( 'after_switch_theme', array( $this, 'set_storefront_style_theme_mods' ) );
|
|
|
|
add_action( 'customize_save_after', array( $this, 'set_storefront_style_theme_mods' ) );
|
2016-01-20 16:02:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-02-19 16:57:56 +00:00
|
|
|
* Returns an array of the desired default Storefront Options
|
|
|
|
*
|
|
|
|
* @return array
|
2016-01-20 16:02:53 +00:00
|
|
|
*/
|
2016-03-03 13:38:40 +00:00
|
|
|
public static function get_storefront_default_setting_values() {
|
2016-02-19 16:57:56 +00:00
|
|
|
return apply_filters( 'storefront_setting_default_values', $args = array(
|
2017-02-07 14:33:17 +00:00
|
|
|
'storefront_heading_color' => '#333333',
|
|
|
|
'storefront_text_color' => '#6d6d6d',
|
2016-03-21 11:21:37 +00:00
|
|
|
'storefront_accent_color' => '#96588a',
|
2017-02-06 12:27:24 +00:00
|
|
|
'storefront_header_background_color' => '#ffffff',
|
2017-02-07 14:33:17 +00:00
|
|
|
'storefront_header_text_color' => '#6d6d6d',
|
|
|
|
'storefront_header_link_color' => '#333333',
|
2016-03-03 11:45:09 +00:00
|
|
|
'storefront_footer_background_color' => '#f0f0f0',
|
2017-02-07 14:33:17 +00:00
|
|
|
'storefront_footer_heading_color' => '#333333',
|
|
|
|
'storefront_footer_text_color' => '#6d6d6d',
|
|
|
|
'storefront_footer_link_color' => '#333333',
|
|
|
|
'storefront_button_background_color' => '#eeeeee',
|
|
|
|
'storefront_button_text_color' => '#333333',
|
|
|
|
'storefront_button_alt_background_color' => '#333333',
|
2016-03-03 11:45:09 +00:00
|
|
|
'storefront_button_alt_text_color' => '#ffffff',
|
2016-03-03 13:27:26 +00:00
|
|
|
'storefront_layout' => 'right',
|
2017-02-07 14:33:17 +00:00
|
|
|
'background_color' => 'ffffff',
|
2016-02-19 16:57:56 +00:00
|
|
|
) );
|
|
|
|
}
|
2016-01-20 16:02:53 +00:00
|
|
|
|
|
|
|
/**
|
2016-02-19 16:57:56 +00:00
|
|
|
* Adds a value to each Storefront setting if one isn't already present.
|
|
|
|
*
|
|
|
|
* @uses get_storefront_default_setting_values()
|
2016-01-20 16:02:53 +00:00
|
|
|
*/
|
2016-02-19 16:57:56 +00:00
|
|
|
public function default_theme_mod_values() {
|
2016-07-28 11:34:41 -03:00
|
|
|
foreach ( self::get_storefront_default_setting_values() as $mod => $val ) {
|
|
|
|
add_filter( 'theme_mod_' . $mod, array( $this, 'get_theme_mod_value' ), 10 );
|
2016-02-19 16:57:56 +00:00
|
|
|
}
|
|
|
|
}
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2016-07-28 11:34:41 -03:00
|
|
|
/**
|
|
|
|
* Get theme mod value.
|
|
|
|
*
|
|
|
|
* @param string $value
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function get_theme_mod_value( $value ) {
|
2016-09-06 22:31:39 +01:00
|
|
|
$key = substr( current_filter(), 10 );
|
|
|
|
|
|
|
|
$set_theme_mods = get_theme_mods();
|
|
|
|
|
|
|
|
if ( isset( $set_theme_mods[ $key ] ) ) {
|
2016-07-28 11:34:41 -03:00
|
|
|
return $value;
|
|
|
|
}
|
|
|
|
|
2016-09-07 09:49:03 +01:00
|
|
|
$values = $this->get_storefront_default_setting_values();
|
2016-07-28 11:34:41 -03:00
|
|
|
|
|
|
|
return isset( $values[ $key ] ) ? $values[ $key ] : $value;
|
|
|
|
}
|
|
|
|
|
2016-05-10 15:59:49 +01:00
|
|
|
/**
|
|
|
|
* Set Customizer setting defaults.
|
|
|
|
* These defaults need to be applied separately as child themes can filter storefront_setting_default_values
|
|
|
|
*
|
|
|
|
* @param array $wp_customize the Customizer object.
|
|
|
|
* @uses get_storefront_default_setting_values()
|
|
|
|
*/
|
|
|
|
public function edit_default_customizer_settings( $wp_customize ) {
|
2016-07-28 11:34:41 -03:00
|
|
|
foreach ( self::get_storefront_default_setting_values() as $mod => $val ) {
|
2016-05-10 15:59:49 +01:00
|
|
|
$wp_customize->get_setting( $mod )->default = $val;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-20 16:02:53 +00:00
|
|
|
/**
|
2016-02-19 16:57:56 +00:00
|
|
|
* Setup the WordPress core custom header feature.
|
|
|
|
*
|
|
|
|
* @uses storefront_header_style()
|
|
|
|
* @uses storefront_admin_header_style()
|
|
|
|
* @uses storefront_admin_header_image()
|
2016-01-20 16:02:53 +00:00
|
|
|
*/
|
2016-02-19 16:57:56 +00:00
|
|
|
public function custom_header_setup() {
|
|
|
|
add_theme_support( 'custom-header', apply_filters( 'storefront_custom_header_args', array(
|
|
|
|
'default-image' => '',
|
|
|
|
'header-text' => false,
|
|
|
|
'width' => 1950,
|
|
|
|
'height' => 500,
|
|
|
|
'flex-width' => true,
|
|
|
|
'flex-height' => true,
|
|
|
|
) ) );
|
|
|
|
}
|
2016-01-20 16:02:53 +00:00
|
|
|
|
|
|
|
/**
|
2016-02-19 16:57:56 +00:00
|
|
|
* Add postMessage support for site title and description for the Theme Customizer along with several other settings.
|
|
|
|
*
|
|
|
|
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
|
|
|
|
* @since 1.0.0
|
2016-01-20 16:02:53 +00:00
|
|
|
*/
|
2016-02-19 16:57:56 +00:00
|
|
|
public function customize_register( $wp_customize ) {
|
|
|
|
|
|
|
|
// Move background color setting alongside background image.
|
|
|
|
$wp_customize->get_control( 'background_color' )->section = 'background_image';
|
|
|
|
$wp_customize->get_control( 'background_color' )->priority = 20;
|
|
|
|
|
|
|
|
// Change background image section title & priority.
|
|
|
|
$wp_customize->get_section( 'background_image' )->title = __( 'Background', 'storefront' );
|
|
|
|
$wp_customize->get_section( 'background_image' )->priority = 30;
|
|
|
|
|
|
|
|
// Change header image section title & priority.
|
|
|
|
$wp_customize->get_section( 'header_image' )->title = __( 'Header', 'storefront' );
|
|
|
|
$wp_customize->get_section( 'header_image' )->priority = 25;
|
|
|
|
|
2016-07-27 19:58:58 +01:00
|
|
|
// Selective refresh.
|
2016-09-08 10:58:17 +01:00
|
|
|
if ( function_exists( 'add_partial' ) ) {
|
|
|
|
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
|
|
|
|
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
|
|
|
|
|
|
|
|
$wp_customize->selective_refresh->add_partial( 'custom_logo', array(
|
|
|
|
'selector' => '.site-branding',
|
2016-10-08 02:22:00 -03:00
|
|
|
'render_callback' => array( $this, 'get_site_logo' ),
|
2016-09-08 10:58:17 +01:00
|
|
|
) );
|
|
|
|
|
|
|
|
$wp_customize->selective_refresh->add_partial( 'blogname', array(
|
|
|
|
'selector' => '.site-title.beta a',
|
2016-10-08 02:22:00 -03:00
|
|
|
'render_callback' => array( $this, 'get_site_name' ),
|
2016-09-08 10:58:17 +01:00
|
|
|
) );
|
|
|
|
|
|
|
|
$wp_customize->selective_refresh->add_partial( 'blogdescription', array(
|
|
|
|
'selector' => '.site-description',
|
2016-10-08 02:22:00 -03:00
|
|
|
'render_callback' => array( $this, 'get_site_description' ),
|
2016-09-08 10:58:17 +01:00
|
|
|
) );
|
|
|
|
}
|
2016-07-27 19:58:58 +01:00
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
/**
|
|
|
|
* Custom controls
|
|
|
|
*/
|
|
|
|
require_once dirname( __FILE__ ) . '/class-storefront-customizer-control-radio-image.php';
|
|
|
|
require_once dirname( __FILE__ ) . '/class-storefront-customizer-control-arbitrary.php';
|
|
|
|
|
|
|
|
if ( apply_filters( 'storefront_customizer_more', true ) ) {
|
|
|
|
require_once dirname( __FILE__ ) . '/class-storefront-customizer-control-more.php';
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add the typography section
|
2016-07-27 19:58:58 +01:00
|
|
|
*/
|
2016-02-19 16:57:56 +00:00
|
|
|
$wp_customize->add_section( 'storefront_typography' , array(
|
|
|
|
'title' => __( 'Typography', 'storefront' ),
|
|
|
|
'priority' => 45,
|
|
|
|
) );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Heading color
|
|
|
|
*/
|
|
|
|
$wp_customize->add_setting( 'storefront_heading_color', array(
|
|
|
|
'default' => apply_filters( 'storefront_default_heading_color', '#484c51' ),
|
|
|
|
'sanitize_callback' => 'sanitize_hex_color',
|
|
|
|
) );
|
|
|
|
|
|
|
|
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'storefront_heading_color', array(
|
|
|
|
'label' => __( 'Heading color', 'storefront' ),
|
|
|
|
'section' => 'storefront_typography',
|
|
|
|
'settings' => 'storefront_heading_color',
|
|
|
|
'priority' => 20,
|
2016-01-20 16:02:53 +00:00
|
|
|
) ) );
|
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
/**
|
|
|
|
* Text Color
|
|
|
|
*/
|
|
|
|
$wp_customize->add_setting( 'storefront_text_color', array(
|
2016-04-15 10:10:20 +01:00
|
|
|
'default' => apply_filters( 'storefront_default_text_color', '#43454b' ),
|
2016-02-19 16:57:56 +00:00
|
|
|
'sanitize_callback' => 'sanitize_hex_color',
|
|
|
|
) );
|
|
|
|
|
|
|
|
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'storefront_text_color', array(
|
|
|
|
'label' => __( 'Text color', 'storefront' ),
|
|
|
|
'section' => 'storefront_typography',
|
|
|
|
'settings' => 'storefront_text_color',
|
|
|
|
'priority' => 30,
|
2016-01-20 16:02:53 +00:00
|
|
|
) ) );
|
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
/**
|
|
|
|
* Accent Color
|
|
|
|
*/
|
|
|
|
$wp_customize->add_setting( 'storefront_accent_color', array(
|
2016-04-18 17:54:32 +01:00
|
|
|
'default' => apply_filters( 'storefront_default_accent_color', '#96588a' ),
|
2016-02-19 16:57:56 +00:00
|
|
|
'sanitize_callback' => 'sanitize_hex_color',
|
|
|
|
) );
|
|
|
|
|
|
|
|
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'storefront_accent_color', array(
|
|
|
|
'label' => __( 'Link / accent color', 'storefront' ),
|
|
|
|
'section' => 'storefront_typography',
|
|
|
|
'settings' => 'storefront_accent_color',
|
|
|
|
'priority' => 40,
|
2016-01-20 16:02:53 +00:00
|
|
|
) ) );
|
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
$wp_customize->add_control( new Arbitrary_Storefront_Control( $wp_customize, 'storefront_header_image_heading', array(
|
|
|
|
'section' => 'header_image',
|
|
|
|
'type' => 'heading',
|
|
|
|
'label' => __( 'Header background image', 'storefront' ),
|
|
|
|
'priority' => 6,
|
|
|
|
) ) );
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
/**
|
|
|
|
* Header Background
|
|
|
|
*/
|
|
|
|
$wp_customize->add_setting( 'storefront_header_background_color', array(
|
|
|
|
'default' => apply_filters( 'storefront_default_header_background_color', '#2c2d33' ),
|
|
|
|
'sanitize_callback' => 'sanitize_hex_color',
|
|
|
|
) );
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'storefront_header_background_color', array(
|
|
|
|
'label' => __( 'Background color', 'storefront' ),
|
|
|
|
'section' => 'header_image',
|
|
|
|
'settings' => 'storefront_header_background_color',
|
|
|
|
'priority' => 15,
|
|
|
|
) ) );
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
/**
|
|
|
|
* Header text color
|
|
|
|
*/
|
|
|
|
$wp_customize->add_setting( 'storefront_header_text_color', array(
|
|
|
|
'default' => apply_filters( 'storefront_default_header_text_color', '#9aa0a7' ),
|
|
|
|
'sanitize_callback' => 'sanitize_hex_color',
|
|
|
|
) );
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'storefront_header_text_color', array(
|
|
|
|
'label' => __( 'Text color', 'storefront' ),
|
|
|
|
'section' => 'header_image',
|
|
|
|
'settings' => 'storefront_header_text_color',
|
|
|
|
'priority' => 20,
|
|
|
|
) ) );
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
/**
|
|
|
|
* Header link color
|
|
|
|
*/
|
|
|
|
$wp_customize->add_setting( 'storefront_header_link_color', array(
|
2016-04-25 13:49:21 +01:00
|
|
|
'default' => apply_filters( 'storefront_default_header_link_color', '#d5d9db' ),
|
2016-02-19 16:57:56 +00:00
|
|
|
'sanitize_callback' => 'sanitize_hex_color',
|
|
|
|
) );
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'storefront_header_link_color', array(
|
|
|
|
'label' => __( 'Link color', 'storefront' ),
|
|
|
|
'section' => 'header_image',
|
|
|
|
'settings' => 'storefront_header_link_color',
|
|
|
|
'priority' => 30,
|
|
|
|
) ) );
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
/**
|
|
|
|
* Footer section
|
|
|
|
*/
|
|
|
|
$wp_customize->add_section( 'storefront_footer' , array(
|
|
|
|
'title' => __( 'Footer', 'storefront' ),
|
|
|
|
'priority' => 28,
|
|
|
|
'description' => __( 'Customise the look & feel of your web site footer.', 'storefront' ),
|
|
|
|
) );
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
/**
|
|
|
|
* Footer Background
|
|
|
|
*/
|
|
|
|
$wp_customize->add_setting( 'storefront_footer_background_color', array(
|
|
|
|
'default' => apply_filters( 'storefront_default_footer_background_color', '#f0f0f0' ),
|
|
|
|
'sanitize_callback' => 'sanitize_hex_color',
|
|
|
|
) );
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'storefront_footer_background_color', array(
|
|
|
|
'label' => __( 'Background color', 'storefront' ),
|
|
|
|
'section' => 'storefront_footer',
|
|
|
|
'settings' => 'storefront_footer_background_color',
|
|
|
|
'priority' => 10,
|
|
|
|
) ) );
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
/**
|
|
|
|
* Footer heading color
|
|
|
|
*/
|
|
|
|
$wp_customize->add_setting( 'storefront_footer_heading_color', array(
|
|
|
|
'default' => apply_filters( 'storefront_default_footer_heading_color', '#494c50' ),
|
|
|
|
'sanitize_callback' => 'sanitize_hex_color',
|
|
|
|
) );
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'storefront_footer_heading_color', array(
|
|
|
|
'label' => __( 'Heading color', 'storefront' ),
|
|
|
|
'section' => 'storefront_footer',
|
|
|
|
'settings' => 'storefront_footer_heading_color',
|
|
|
|
'priority' => 20,
|
|
|
|
) ) );
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
/**
|
|
|
|
* Footer text color
|
|
|
|
*/
|
|
|
|
$wp_customize->add_setting( 'storefront_footer_text_color', array(
|
|
|
|
'default' => apply_filters( 'storefront_default_footer_text_color', '#61656b' ),
|
|
|
|
'sanitize_callback' => 'sanitize_hex_color',
|
|
|
|
) );
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'storefront_footer_text_color', array(
|
|
|
|
'label' => __( 'Text color', 'storefront' ),
|
|
|
|
'section' => 'storefront_footer',
|
|
|
|
'settings' => 'storefront_footer_text_color',
|
|
|
|
'priority' => 30,
|
|
|
|
) ) );
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
/**
|
|
|
|
* Footer link color
|
|
|
|
*/
|
|
|
|
$wp_customize->add_setting( 'storefront_footer_link_color', array(
|
|
|
|
'default' => apply_filters( 'storefront_default_footer_link_color', '#2c2d33' ),
|
|
|
|
'sanitize_callback' => 'sanitize_hex_color',
|
|
|
|
) );
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'storefront_footer_link_color', array(
|
|
|
|
'label' => __( 'Link color', 'storefront' ),
|
|
|
|
'section' => 'storefront_footer',
|
|
|
|
'settings' => 'storefront_footer_link_color',
|
|
|
|
'priority' => 40,
|
|
|
|
) ) );
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
/**
|
|
|
|
* Buttons section
|
|
|
|
*/
|
|
|
|
$wp_customize->add_section( 'storefront_buttons' , array(
|
|
|
|
'title' => __( 'Buttons', 'storefront' ),
|
|
|
|
'priority' => 45,
|
|
|
|
'description' => __( 'Customise the look & feel of your web site buttons.', 'storefront' ),
|
2016-01-20 16:02:53 +00:00
|
|
|
) );
|
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
/**
|
|
|
|
* Button background color
|
|
|
|
*/
|
|
|
|
$wp_customize->add_setting( 'storefront_button_background_color', array(
|
2016-04-18 17:54:32 +01:00
|
|
|
'default' => apply_filters( 'storefront_default_button_background_color', '#96588a' ),
|
2016-02-19 16:57:56 +00:00
|
|
|
'sanitize_callback' => 'sanitize_hex_color',
|
2016-01-20 16:02:53 +00:00
|
|
|
) );
|
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'storefront_button_background_color', array(
|
|
|
|
'label' => __( 'Background color', 'storefront' ),
|
|
|
|
'section' => 'storefront_buttons',
|
|
|
|
'settings' => 'storefront_button_background_color',
|
|
|
|
'priority' => 10,
|
2016-01-20 16:02:53 +00:00
|
|
|
) ) );
|
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
/**
|
|
|
|
* Button text color
|
|
|
|
*/
|
|
|
|
$wp_customize->add_setting( 'storefront_button_text_color', array(
|
|
|
|
'default' => apply_filters( 'storefront_default_button_text_color', '#ffffff' ),
|
|
|
|
'sanitize_callback' => 'sanitize_hex_color',
|
|
|
|
) );
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'storefront_button_text_color', array(
|
|
|
|
'label' => __( 'Text color', 'storefront' ),
|
|
|
|
'section' => 'storefront_buttons',
|
|
|
|
'settings' => 'storefront_button_text_color',
|
|
|
|
'priority' => 20,
|
|
|
|
) ) );
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
/**
|
|
|
|
* Button alt background color
|
|
|
|
*/
|
|
|
|
$wp_customize->add_setting( 'storefront_button_alt_background_color', array(
|
|
|
|
'default' => apply_filters( 'storefront_default_button_alt_background_color', '#2c2d33' ),
|
|
|
|
'sanitize_callback' => 'sanitize_hex_color',
|
|
|
|
) );
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'storefront_button_alt_background_color', array(
|
|
|
|
'label' => __( 'Alternate button background color', 'storefront' ),
|
|
|
|
'section' => 'storefront_buttons',
|
|
|
|
'settings' => 'storefront_button_alt_background_color',
|
|
|
|
'priority' => 30,
|
|
|
|
) ) );
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
/**
|
|
|
|
* Button alt text color
|
|
|
|
*/
|
|
|
|
$wp_customize->add_setting( 'storefront_button_alt_text_color', array(
|
|
|
|
'default' => apply_filters( 'storefront_default_button_alt_text_color', '#ffffff' ),
|
|
|
|
'sanitize_callback' => 'sanitize_hex_color',
|
|
|
|
) );
|
2016-02-08 17:13:41 +00:00
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'storefront_button_alt_text_color', array(
|
|
|
|
'label' => __( 'Alternate button text color', 'storefront' ),
|
|
|
|
'section' => 'storefront_buttons',
|
|
|
|
'settings' => 'storefront_button_alt_text_color',
|
|
|
|
'priority' => 40,
|
|
|
|
) ) );
|
2016-02-08 17:13:41 +00:00
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
/**
|
|
|
|
* Layout
|
|
|
|
*/
|
|
|
|
$wp_customize->add_section( 'storefront_layout' , array(
|
|
|
|
'title' => __( 'Layout', 'storefront' ),
|
|
|
|
'priority' => 50,
|
|
|
|
) );
|
2016-02-08 17:13:41 +00:00
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
$wp_customize->add_setting( 'storefront_layout', array(
|
|
|
|
'default' => apply_filters( 'storefront_default_layout', $layout = is_rtl() ? 'left' : 'right' ),
|
|
|
|
'sanitize_callback' => 'storefront_sanitize_choices',
|
|
|
|
) );
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
$wp_customize->add_control( new Storefront_Custom_Radio_Image_Control( $wp_customize, 'storefront_layout', array(
|
|
|
|
'settings' => 'storefront_layout',
|
|
|
|
'section' => 'storefront_layout',
|
|
|
|
'label' => __( 'General Layout', 'storefront' ),
|
|
|
|
'priority' => 1,
|
|
|
|
'choices' => array(
|
|
|
|
'right' => get_template_directory_uri() . '/assets/images/customizer/controls/2cr.png',
|
|
|
|
'left' => get_template_directory_uri() . '/assets/images/customizer/controls/2cl.png',
|
|
|
|
),
|
|
|
|
) ) );
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
/**
|
|
|
|
* More
|
|
|
|
*/
|
|
|
|
if ( apply_filters( 'storefront_customizer_more', true ) ) {
|
|
|
|
$wp_customize->add_section( 'storefront_more' , array(
|
|
|
|
'title' => __( 'More', 'storefront' ),
|
|
|
|
'priority' => 999,
|
|
|
|
) );
|
|
|
|
|
|
|
|
$wp_customize->add_setting( 'storefront_more', array(
|
|
|
|
'default' => null,
|
|
|
|
'sanitize_callback' => 'sanitize_text_field',
|
|
|
|
) );
|
|
|
|
|
|
|
|
$wp_customize->add_control( new More_Storefront_Control( $wp_customize, 'storefront_more', array(
|
|
|
|
'label' => __( 'Looking for more options?', 'storefront' ),
|
|
|
|
'section' => 'storefront_more',
|
|
|
|
'settings' => 'storefront_more',
|
|
|
|
'priority' => 1,
|
|
|
|
) ) );
|
|
|
|
}
|
2016-01-20 16:02:53 +00:00
|
|
|
}
|
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
/**
|
2016-03-16 14:15:39 +00:00
|
|
|
* Get all of the Storefront theme mods.
|
2016-02-19 16:57:56 +00:00
|
|
|
*
|
2016-03-16 14:15:39 +00:00
|
|
|
* @return array $storefront_theme_mods The Storefront Theme Mods.
|
2016-02-19 16:57:56 +00:00
|
|
|
*/
|
2016-03-16 14:15:39 +00:00
|
|
|
public function get_storefront_theme_mods() {
|
2016-03-17 10:53:28 +00:00
|
|
|
$storefront_theme_mods = array(
|
|
|
|
'background_color' => storefront_get_content_background_color(),
|
|
|
|
'accent_color' => get_theme_mod( 'storefront_accent_color' ),
|
|
|
|
'header_background_color' => get_theme_mod( 'storefront_header_background_color' ),
|
|
|
|
'header_link_color' => get_theme_mod( 'storefront_header_link_color' ),
|
|
|
|
'header_text_color' => get_theme_mod( 'storefront_header_text_color' ),
|
|
|
|
'footer_background_color' => get_theme_mod( 'storefront_footer_background_color' ),
|
|
|
|
'footer_link_color' => get_theme_mod( 'storefront_footer_link_color' ),
|
|
|
|
'footer_heading_color' => get_theme_mod( 'storefront_footer_heading_color' ),
|
|
|
|
'footer_text_color' => get_theme_mod( 'storefront_footer_text_color' ),
|
|
|
|
'text_color' => get_theme_mod( 'storefront_text_color' ),
|
|
|
|
'heading_color' => get_theme_mod( 'storefront_heading_color' ),
|
|
|
|
'button_background_color' => get_theme_mod( 'storefront_button_background_color' ),
|
|
|
|
'button_text_color' => get_theme_mod( 'storefront_button_text_color' ),
|
|
|
|
'button_alt_background_color' => get_theme_mod( 'storefront_button_alt_background_color' ),
|
|
|
|
'button_alt_text_color' => get_theme_mod( 'storefront_button_alt_text_color' ),
|
|
|
|
);
|
2016-03-16 14:15:39 +00:00
|
|
|
|
|
|
|
return apply_filters( 'storefront_theme_mods', $storefront_theme_mods );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get Customizer css.
|
|
|
|
*
|
|
|
|
* @see get_storefront_theme_mods()
|
|
|
|
* @return array $styles the css
|
|
|
|
*/
|
|
|
|
public function get_css() {
|
|
|
|
$storefront_theme_mods = $this->get_storefront_theme_mods();
|
|
|
|
$brighten_factor = apply_filters( 'storefront_brighten_factor', 25 );
|
|
|
|
$darken_factor = apply_filters( 'storefront_darken_factor', -25 );
|
|
|
|
|
|
|
|
$styles = '
|
2016-02-19 16:57:56 +00:00
|
|
|
.main-navigation ul li a,
|
|
|
|
.site-title a,
|
|
|
|
ul.menu li a,
|
|
|
|
.site-branding h1 a,
|
2016-03-15 15:57:26 +00:00
|
|
|
.site-footer .storefront-handheld-footer-bar a:not(.button),
|
|
|
|
button.menu-toggle,
|
|
|
|
button.menu-toggle:hover {
|
2016-03-16 14:15:39 +00:00
|
|
|
color: ' . $storefront_theme_mods['header_link_color'] . ';
|
2016-02-19 16:57:56 +00:00
|
|
|
}
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2016-03-15 15:57:26 +00:00
|
|
|
button.menu-toggle,
|
|
|
|
button.menu-toggle:hover {
|
2016-03-16 14:15:39 +00:00
|
|
|
border-color: ' . $storefront_theme_mods['header_link_color'] . ';
|
2016-03-15 15:57:26 +00:00
|
|
|
}
|
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
.main-navigation ul li a:hover,
|
|
|
|
.main-navigation ul li:hover > a,
|
|
|
|
.site-title a:hover,
|
|
|
|
a.cart-contents:hover,
|
|
|
|
.site-header-cart .widget_shopping_cart a:hover,
|
|
|
|
.site-header-cart:hover > li > a,
|
2016-05-31 11:40:04 +01:00
|
|
|
.site-header ul.menu li.current-menu-item > a {
|
2017-02-07 14:33:17 +00:00
|
|
|
color: ' . storefront_adjust_color_brightness( $storefront_theme_mods['header_link_color'], 80 ) . ';
|
2016-02-19 16:57:56 +00:00
|
|
|
}
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2016-03-18 12:32:07 +00:00
|
|
|
table th {
|
2016-04-15 10:10:20 +01:00
|
|
|
background-color: ' . storefront_adjust_color_brightness( $storefront_theme_mods['background_color'], -7 ) . ';
|
2016-03-18 12:32:07 +00:00
|
|
|
}
|
|
|
|
|
2017-02-27 11:20:36 +00:00
|
|
|
table tbody td {
|
2016-04-15 10:10:20 +01:00
|
|
|
background-color: ' . storefront_adjust_color_brightness( $storefront_theme_mods['background_color'], -2 ) . ';
|
2016-03-18 12:32:07 +00:00
|
|
|
}
|
|
|
|
|
2017-02-27 11:20:36 +00:00
|
|
|
table tbody tr:nth-child(2n) td,
|
|
|
|
fieldset,
|
|
|
|
fieldset legend {
|
2016-04-15 10:10:20 +01:00
|
|
|
background-color: ' . storefront_adjust_color_brightness( $storefront_theme_mods['background_color'], -4 ) . ';
|
2016-03-18 12:32:07 +00:00
|
|
|
}
|
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
.site-header,
|
|
|
|
.secondary-navigation ul ul,
|
|
|
|
.main-navigation ul.menu > li.menu-item-has-children:after,
|
|
|
|
.secondary-navigation ul.menu ul,
|
|
|
|
.storefront-handheld-footer-bar,
|
|
|
|
.storefront-handheld-footer-bar ul li > a,
|
2016-03-15 15:57:26 +00:00
|
|
|
.storefront-handheld-footer-bar ul li.search .site-search,
|
|
|
|
button.menu-toggle,
|
|
|
|
button.menu-toggle:hover {
|
2016-03-16 14:15:39 +00:00
|
|
|
background-color: ' . $storefront_theme_mods['header_background_color'] . ';
|
2016-02-19 16:57:56 +00:00
|
|
|
}
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
p.site-description,
|
|
|
|
.site-header,
|
|
|
|
.storefront-handheld-footer-bar {
|
2016-03-16 14:15:39 +00:00
|
|
|
color: ' . $storefront_theme_mods['header_text_color'] . ';
|
2016-02-19 16:57:56 +00:00
|
|
|
}
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2016-03-15 16:06:04 +00:00
|
|
|
.storefront-handheld-footer-bar ul li.cart .count,
|
|
|
|
button.menu-toggle:after,
|
|
|
|
button.menu-toggle:before,
|
|
|
|
button.menu-toggle span:before {
|
2016-03-16 14:15:39 +00:00
|
|
|
background-color: ' . $storefront_theme_mods['header_link_color'] . ';
|
2016-02-19 16:57:56 +00:00
|
|
|
}
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
.storefront-handheld-footer-bar ul li.cart .count {
|
2016-03-16 14:15:39 +00:00
|
|
|
color: ' . $storefront_theme_mods['header_background_color'] . ';
|
2016-02-19 16:57:56 +00:00
|
|
|
}
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
.storefront-handheld-footer-bar ul li.cart .count {
|
2016-03-16 14:15:39 +00:00
|
|
|
border-color: ' . $storefront_theme_mods['header_background_color'] . ';
|
2016-02-19 16:57:56 +00:00
|
|
|
}
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
h1, h2, h3, h4, h5, h6 {
|
2016-03-16 14:15:39 +00:00
|
|
|
color: ' . $storefront_theme_mods['heading_color'] . ';
|
2016-02-19 16:57:56 +00:00
|
|
|
}
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
.widget h1 {
|
2016-03-18 14:34:16 +00:00
|
|
|
border-bottom-color: ' . $storefront_theme_mods['heading_color'] . ';
|
2016-02-19 16:57:56 +00:00
|
|
|
}
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
body,
|
|
|
|
.secondary-navigation a,
|
|
|
|
.onsale,
|
|
|
|
.pagination .page-numbers li .page-numbers:not(.current), .woocommerce-pagination .page-numbers li .page-numbers:not(.current) {
|
2016-03-16 14:15:39 +00:00
|
|
|
color: ' . $storefront_theme_mods['text_color'] . ';
|
2016-02-19 16:57:56 +00:00
|
|
|
}
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2016-04-11 15:16:11 -05:00
|
|
|
.widget-area .widget a,
|
|
|
|
.hentry .entry-header .posted-on a,
|
|
|
|
.hentry .entry-header .byline a {
|
|
|
|
color: ' . storefront_adjust_color_brightness( $storefront_theme_mods['text_color'], 50 ) . ';
|
|
|
|
}
|
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
a {
|
2016-03-16 14:15:39 +00:00
|
|
|
color: ' . $storefront_theme_mods['accent_color'] . ';
|
2016-01-20 16:02:53 +00:00
|
|
|
}
|
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
a:focus,
|
|
|
|
.button:focus,
|
|
|
|
.button.alt:focus,
|
|
|
|
.button.added_to_cart:focus,
|
|
|
|
.button.wc-forward:focus,
|
|
|
|
button:focus,
|
|
|
|
input[type="button"]:focus,
|
|
|
|
input[type="reset"]:focus,
|
|
|
|
input[type="submit"]:focus {
|
2016-03-16 14:15:39 +00:00
|
|
|
outline-color: ' . $storefront_theme_mods['accent_color'] . ';
|
2016-01-20 16:02:53 +00:00
|
|
|
}
|
|
|
|
|
2016-05-11 14:43:56 +01:00
|
|
|
button, input[type="button"], input[type="reset"], input[type="submit"], .button, .added_to_cart, .widget a.button, .site-header-cart .widget_shopping_cart a.button {
|
2016-03-16 14:15:39 +00:00
|
|
|
background-color: ' . $storefront_theme_mods['button_background_color'] . ';
|
|
|
|
border-color: ' . $storefront_theme_mods['button_background_color'] . ';
|
|
|
|
color: ' . $storefront_theme_mods['button_text_color'] . ';
|
2016-01-20 16:02:53 +00:00
|
|
|
}
|
|
|
|
|
2016-05-11 14:43:56 +01:00
|
|
|
button:hover, input[type="button"]:hover, input[type="reset"]:hover, input[type="submit"]:hover, .button:hover, .added_to_cart:hover, .widget a.button:hover, .site-header-cart .widget_shopping_cart a.button:hover {
|
2016-03-16 14:15:39 +00:00
|
|
|
background-color: ' . storefront_adjust_color_brightness( $storefront_theme_mods['button_background_color'], $darken_factor ) . ';
|
|
|
|
border-color: ' . storefront_adjust_color_brightness( $storefront_theme_mods['button_background_color'], $darken_factor ) . ';
|
|
|
|
color: ' . $storefront_theme_mods['button_text_color'] . ';
|
2016-01-20 16:02:53 +00:00
|
|
|
}
|
|
|
|
|
2017-02-07 14:33:17 +00:00
|
|
|
button.alt, input[type="button"].alt, input[type="reset"].alt, input[type="submit"].alt, .button.alt, .added_to_cart.alt, .widget-area .widget a.button.alt, .added_to_cart, .widget a.button.checkout {
|
2016-03-16 14:15:39 +00:00
|
|
|
background-color: ' . $storefront_theme_mods['button_alt_background_color'] . ';
|
|
|
|
border-color: ' . $storefront_theme_mods['button_alt_background_color'] . ';
|
|
|
|
color: ' . $storefront_theme_mods['button_alt_text_color'] . ';
|
2016-02-19 16:57:56 +00:00
|
|
|
}
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2016-05-11 14:43:56 +01:00
|
|
|
button.alt:hover, input[type="button"].alt:hover, input[type="reset"].alt:hover, input[type="submit"].alt:hover, .button.alt:hover, .added_to_cart.alt:hover, .widget-area .widget a.button.alt:hover, .added_to_cart:hover, .widget a.button.checkout:hover {
|
2016-03-16 14:15:39 +00:00
|
|
|
background-color: ' . storefront_adjust_color_brightness( $storefront_theme_mods['button_alt_background_color'], $darken_factor ) . ';
|
|
|
|
border-color: ' . storefront_adjust_color_brightness( $storefront_theme_mods['button_alt_background_color'], $darken_factor ) . ';
|
|
|
|
color: ' . $storefront_theme_mods['button_alt_text_color'] . ';
|
2016-02-19 16:57:56 +00:00
|
|
|
}
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2017-02-07 14:33:17 +00:00
|
|
|
.pagination .page-numbers li .page-numbers.current, .woocommerce-pagination .page-numbers li .page-numbers.current {
|
|
|
|
background-color: ' . storefront_adjust_color_brightness( $storefront_theme_mods['background_color'], $darken_factor ) . ';
|
|
|
|
color: ' . $storefront_theme_mods['text_color'] . ';
|
|
|
|
}
|
|
|
|
|
2016-04-25 13:49:21 +01:00
|
|
|
#comments .comment-list .comment-content .comment-text {
|
|
|
|
background-color: ' . storefront_adjust_color_brightness( $storefront_theme_mods['background_color'], -7 ) . ';
|
|
|
|
}
|
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
.site-footer {
|
2016-03-16 14:15:39 +00:00
|
|
|
background-color: ' . $storefront_theme_mods['footer_background_color'] . ';
|
|
|
|
color: ' . $storefront_theme_mods['footer_text_color'] . ';
|
2016-02-19 16:57:56 +00:00
|
|
|
}
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
.site-footer a:not(.button) {
|
2016-03-16 14:15:39 +00:00
|
|
|
color: ' . $storefront_theme_mods['footer_link_color'] . ';
|
2016-02-19 16:57:56 +00:00
|
|
|
}
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
.site-footer h1, .site-footer h2, .site-footer h3, .site-footer h4, .site-footer h5, .site-footer h6 {
|
2016-03-16 14:15:39 +00:00
|
|
|
color: ' . $storefront_theme_mods['footer_heading_color'] . ';
|
2016-02-19 16:57:56 +00:00
|
|
|
}
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2017-02-07 14:33:17 +00:00
|
|
|
#order_review {
|
2016-03-18 12:32:07 +00:00
|
|
|
background-color: ' . $storefront_theme_mods['background_color'] . ';
|
|
|
|
}
|
|
|
|
|
2017-02-07 14:33:17 +00:00
|
|
|
#payment .payment_methods > li .payment_box,
|
|
|
|
#payment .place-order {
|
2016-04-15 10:10:20 +01:00
|
|
|
background-color: ' . storefront_adjust_color_brightness( $storefront_theme_mods['background_color'], -5 ) . ';
|
2016-03-18 12:32:07 +00:00
|
|
|
}
|
|
|
|
|
2017-02-07 14:33:17 +00:00
|
|
|
#payment .payment_methods > li {
|
2016-04-15 10:10:20 +01:00
|
|
|
background-color: ' . storefront_adjust_color_brightness( $storefront_theme_mods['background_color'], -10 ) . ';
|
2016-02-19 16:57:56 +00:00
|
|
|
}
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2017-02-07 14:33:17 +00:00
|
|
|
#payment .payment_methods > li:hover {
|
|
|
|
background-color: ' . storefront_adjust_color_brightness( $storefront_theme_mods['background_color'], -15 ) . ';
|
|
|
|
}
|
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
@media screen and ( min-width: 768px ) {
|
|
|
|
.secondary-navigation ul.menu a:hover {
|
2016-03-16 14:15:39 +00:00
|
|
|
color: ' . storefront_adjust_color_brightness( $storefront_theme_mods['header_text_color'], $brighten_factor ) . ';
|
2016-02-19 16:57:56 +00:00
|
|
|
}
|
2016-02-05 10:04:10 +00:00
|
|
|
|
2016-03-18 12:10:14 +00:00
|
|
|
.secondary-navigation ul.menu a {
|
|
|
|
color: ' . $storefront_theme_mods['header_text_color'] . ';
|
2016-02-19 16:57:56 +00:00
|
|
|
}
|
|
|
|
|
2016-03-18 12:10:14 +00:00
|
|
|
.site-header-cart .widget_shopping_cart,
|
|
|
|
.main-navigation ul.menu ul.sub-menu,
|
|
|
|
.main-navigation ul.nav-menu ul.children {
|
2017-02-07 14:33:17 +00:00
|
|
|
background-color: ' . storefront_adjust_color_brightness( $storefront_theme_mods['header_background_color'], -15 ) . ';
|
|
|
|
}
|
|
|
|
|
|
|
|
.site-header-cart .widget_shopping_cart .buttons,
|
|
|
|
.site-header-cart .widget_shopping_cart .total {
|
|
|
|
background-color: ' . storefront_adjust_color_brightness( $storefront_theme_mods['header_background_color'], -10 ) . ';
|
|
|
|
}
|
|
|
|
|
|
|
|
.site-header {
|
|
|
|
border-bottom-color: ' . storefront_adjust_color_brightness( $storefront_theme_mods['header_background_color'], -15 ) . ';
|
2016-02-19 16:57:56 +00:00
|
|
|
}
|
|
|
|
}';
|
|
|
|
|
2016-03-16 14:15:39 +00:00
|
|
|
return apply_filters( 'storefront_customizer_css', $styles );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get Customizer css associated with WooCommerce.
|
|
|
|
*
|
|
|
|
* @see get_storefront_theme_mods()
|
|
|
|
* @return array $woocommerce_styles the WooCommerce css
|
|
|
|
*/
|
|
|
|
public function get_woocommerce_css() {
|
|
|
|
$storefront_theme_mods = $this->get_storefront_theme_mods();
|
|
|
|
$brighten_factor = apply_filters( 'storefront_brighten_factor', 25 );
|
|
|
|
$darken_factor = apply_filters( 'storefront_darken_factor', -25 );
|
|
|
|
|
|
|
|
$woocommerce_styles = '
|
2016-02-19 16:57:56 +00:00
|
|
|
a.cart-contents,
|
|
|
|
.site-header-cart .widget_shopping_cart a {
|
2016-03-16 14:15:39 +00:00
|
|
|
color: ' . $storefront_theme_mods['header_link_color'] . ';
|
2016-01-20 16:02:53 +00:00
|
|
|
}
|
|
|
|
|
2016-03-16 10:24:48 +00:00
|
|
|
table.cart td.product-remove,
|
|
|
|
table.cart td.actions {
|
2016-03-16 14:15:39 +00:00
|
|
|
border-top-color: ' . $storefront_theme_mods['background_color'] . ';
|
2016-03-16 10:24:48 +00:00
|
|
|
}
|
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
.woocommerce-tabs ul.tabs li.active a,
|
|
|
|
ul.products li.product .price,
|
|
|
|
.onsale,
|
|
|
|
.widget_search form:before,
|
|
|
|
.widget_product_search form:before {
|
2016-03-16 14:15:39 +00:00
|
|
|
color: ' . $storefront_theme_mods['text_color'] . ';
|
2016-02-19 16:57:56 +00:00
|
|
|
}
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2016-04-11 15:16:11 -05:00
|
|
|
.woocommerce-breadcrumb a,
|
|
|
|
a.woocommerce-review-link,
|
|
|
|
.product_meta a {
|
2016-03-21 11:21:37 +00:00
|
|
|
color: ' . storefront_adjust_color_brightness( $storefront_theme_mods['text_color'], 50 ) . ';
|
|
|
|
}
|
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
.onsale {
|
2016-03-16 14:15:39 +00:00
|
|
|
border-color: ' . $storefront_theme_mods['text_color'] . ';
|
2016-02-19 16:57:56 +00:00
|
|
|
}
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
.star-rating span:before,
|
|
|
|
.quantity .plus, .quantity .minus,
|
|
|
|
p.stars a:hover:after,
|
|
|
|
p.stars a:after,
|
2016-04-20 12:14:02 +01:00
|
|
|
.star-rating span:before,
|
|
|
|
#payment .payment_methods li input[type=radio]:first-child:checked+label:before {
|
2016-03-16 14:15:39 +00:00
|
|
|
color: ' . $storefront_theme_mods['accent_color'] . ';
|
2016-02-19 16:57:56 +00:00
|
|
|
}
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
.widget_price_filter .ui-slider .ui-slider-range,
|
|
|
|
.widget_price_filter .ui-slider .ui-slider-handle {
|
2016-03-16 14:15:39 +00:00
|
|
|
background-color: ' . $storefront_theme_mods['accent_color'] . ';
|
2016-02-19 16:57:56 +00:00
|
|
|
}
|
2016-01-20 16:02:53 +00:00
|
|
|
|
2016-04-11 15:16:11 -05:00
|
|
|
.order_details {
|
2016-05-03 19:36:50 +01:00
|
|
|
background-color: ' . storefront_adjust_color_brightness( $storefront_theme_mods['background_color'], -7 ) . ';
|
2016-04-11 15:16:11 -05:00
|
|
|
}
|
|
|
|
|
2017-01-17 12:47:53 +00:00
|
|
|
.order_details > li {
|
2016-05-03 19:36:50 +01:00
|
|
|
border-bottom: 1px dotted ' . storefront_adjust_color_brightness( $storefront_theme_mods['background_color'], -28 ) . ';
|
2016-04-11 15:16:11 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
.order_details:before,
|
|
|
|
.order_details:after {
|
2016-05-03 19:36:50 +01:00
|
|
|
background: -webkit-linear-gradient(transparent 0,transparent 0),-webkit-linear-gradient(135deg,' . storefront_adjust_color_brightness( $storefront_theme_mods['background_color'], -7 ) . ' 33.33%,transparent 33.33%),-webkit-linear-gradient(45deg,' . storefront_adjust_color_brightness( $storefront_theme_mods['background_color'], -7 ) . ' 33.33%,transparent 33.33%)
|
2016-04-11 15:16:11 -05:00
|
|
|
}
|
|
|
|
|
2016-10-03 13:58:29 +01:00
|
|
|
p.stars a:before,
|
|
|
|
p.stars a:hover~a:before,
|
2016-10-03 13:40:18 +01:00
|
|
|
p.stars.selected a.active~a:before {
|
|
|
|
color: ' . $storefront_theme_mods['text_color'] . ';
|
|
|
|
}
|
|
|
|
|
2016-10-03 13:58:29 +01:00
|
|
|
p.stars.selected a.active:before,
|
|
|
|
p.stars:hover a:before,
|
2016-10-03 13:40:18 +01:00
|
|
|
p.stars.selected a:not(.active):before,
|
2016-10-03 13:58:29 +01:00
|
|
|
p.stars.selected a.active:before {
|
2016-10-03 13:40:18 +01:00
|
|
|
color: ' . $storefront_theme_mods['accent_color'] . ';
|
|
|
|
}
|
|
|
|
|
2016-10-17 15:37:22 +01:00
|
|
|
.single-product div.product .woocommerce-product-gallery .woocommerce-product-gallery__trigger {
|
|
|
|
background-color: ' . $storefront_theme_mods['button_background_color'] . ';
|
|
|
|
color: ' . $storefront_theme_mods['button_text_color'] . ';
|
|
|
|
}
|
|
|
|
|
|
|
|
.single-product div.product .woocommerce-product-gallery .woocommerce-product-gallery__trigger:hover {
|
|
|
|
background-color: ' . storefront_adjust_color_brightness( $storefront_theme_mods['button_background_color'], $darken_factor ) . ';
|
|
|
|
border-color: ' . storefront_adjust_color_brightness( $storefront_theme_mods['button_background_color'], $darken_factor ) . ';
|
|
|
|
color: ' . $storefront_theme_mods['button_text_color'] . ';
|
|
|
|
}
|
|
|
|
|
2017-01-20 13:05:41 +00:00
|
|
|
.button.loading {
|
|
|
|
color: ' . $storefront_theme_mods['button_background_color'] . ';
|
|
|
|
}
|
|
|
|
|
|
|
|
.button.loading:hover {
|
|
|
|
background-color: ' . $storefront_theme_mods['button_background_color'] . ';
|
|
|
|
}
|
|
|
|
|
|
|
|
.button.loading:after {
|
|
|
|
color: ' . $storefront_theme_mods['button_text_color'] . ';
|
|
|
|
}
|
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
@media screen and ( min-width: 768px ) {
|
|
|
|
.site-header-cart .widget_shopping_cart,
|
|
|
|
.site-header .product_list_widget li .quantity {
|
2016-03-16 14:15:39 +00:00
|
|
|
color: ' . $storefront_theme_mods['header_text_color'] . ';
|
2016-02-19 16:57:56 +00:00
|
|
|
}
|
|
|
|
}';
|
2016-02-04 13:16:31 +00:00
|
|
|
|
2016-03-16 14:15:39 +00:00
|
|
|
return apply_filters( 'storefront_customizer_woocommerce_css', $woocommerce_styles );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Assign Storefront styles to individual theme mods.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function set_storefront_style_theme_mods() {
|
|
|
|
set_theme_mod( 'storefront_styles', $this->get_css() );
|
|
|
|
set_theme_mod( 'storefront_woocommerce_styles', $this->get_woocommerce_css() );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add CSS in <head> for styles handled by the theme customizer
|
2016-05-10 16:36:47 +01:00
|
|
|
* If the Customizer is active pull in the raw css. Otherwise pull in the prepared theme_mods if they exist.
|
2016-03-16 14:15:39 +00:00
|
|
|
*
|
|
|
|
* @since 1.0.0
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function add_customizer_css() {
|
2016-05-10 16:36:47 +01:00
|
|
|
$storefront_styles = get_theme_mod( 'storefront_styles' );
|
|
|
|
$storefront_woocommerce_styles = get_theme_mod( 'storefront_woocommerce_styles' );
|
|
|
|
|
|
|
|
if ( is_customize_preview() || ( defined( 'WP_DEBUG' ) && true === WP_DEBUG ) || ( false === $storefront_styles && false === $storefront_woocommerce_styles ) ) {
|
2016-03-16 14:15:39 +00:00
|
|
|
wp_add_inline_style( 'storefront-style', $this->get_css() );
|
|
|
|
wp_add_inline_style( 'storefront-woocommerce-style', $this->get_woocommerce_css() );
|
|
|
|
} else {
|
|
|
|
wp_add_inline_style( 'storefront-style', get_theme_mod( 'storefront_styles' ) );
|
|
|
|
wp_add_inline_style( 'storefront-woocommerce-style', get_theme_mod( 'storefront_woocommerce_styles' ) );
|
|
|
|
}
|
2016-02-04 13:16:31 +00:00
|
|
|
}
|
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
/**
|
|
|
|
* Layout classes
|
|
|
|
* Adds 'right-sidebar' and 'left-sidebar' classes to the body tag
|
|
|
|
*
|
|
|
|
* @param array $classes current body classes.
|
|
|
|
* @return string[] modified body classes
|
|
|
|
* @since 1.0.0
|
|
|
|
*/
|
|
|
|
public function layout_class( $classes ) {
|
|
|
|
$left_or_right = get_theme_mod( 'storefront_layout' );
|
|
|
|
|
|
|
|
$classes[] = $left_or_right . '-sidebar';
|
2016-02-04 13:16:31 +00:00
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
return $classes;
|
2016-02-04 13:16:31 +00:00
|
|
|
}
|
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
/**
|
|
|
|
* Add CSS for custom controls
|
|
|
|
*
|
|
|
|
* This function incorporates CSS from the Kirki Customizer Framework
|
|
|
|
*
|
|
|
|
* The Kirki Customizer Framework, Copyright Aristeides Stathopoulos (@aristath),
|
|
|
|
* is licensed under the terms of the GNU GPL, Version 2 (or later)
|
|
|
|
*
|
|
|
|
* @link https://github.com/reduxframework/kirki/
|
|
|
|
* @since 1.5.0
|
|
|
|
*/
|
|
|
|
public function customizer_custom_control_css() {
|
|
|
|
?>
|
|
|
|
<style>
|
2017-02-16 20:41:32 +00:00
|
|
|
.customize-control-radio-image input[type=radio] {
|
|
|
|
display: none;
|
2016-02-19 16:57:56 +00:00
|
|
|
}
|
|
|
|
|
2017-02-16 20:41:32 +00:00
|
|
|
.customize-control-radio-image label {
|
|
|
|
display: block;
|
2016-02-19 16:57:56 +00:00
|
|
|
width: 48%;
|
2017-02-16 20:41:32 +00:00
|
|
|
float: left;
|
|
|
|
margin-right: 4%;
|
2016-02-19 16:57:56 +00:00
|
|
|
}
|
|
|
|
|
2017-02-16 20:41:32 +00:00
|
|
|
.customize-control-radio-image label:nth-of-type(2n) {
|
|
|
|
margin-right: 0;
|
2016-02-19 16:57:56 +00:00
|
|
|
}
|
|
|
|
|
2017-02-16 20:41:32 +00:00
|
|
|
.customize-control-radio-image img {
|
|
|
|
opacity: .5;
|
2016-02-19 16:57:56 +00:00
|
|
|
}
|
|
|
|
|
2017-02-16 20:41:32 +00:00
|
|
|
.customize-control-radio-image input[type=radio]:checked + label img,
|
|
|
|
.customize-control-radio-image img:hover {
|
2016-02-19 16:57:56 +00:00
|
|
|
opacity: 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|
|
|
|
<?php
|
2016-02-04 13:16:31 +00:00
|
|
|
}
|
2016-10-08 02:22:00 -03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get site logo.
|
|
|
|
*
|
|
|
|
* @since 2.1.5
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function get_site_logo() {
|
|
|
|
return storefront_site_title_or_logo( false );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get site name.
|
|
|
|
*
|
|
|
|
* @since 2.1.5
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function get_site_name() {
|
|
|
|
return get_bloginfo( 'name', 'display' );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get site description.
|
|
|
|
*
|
|
|
|
* @since 2.1.5
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function get_site_description() {
|
|
|
|
return get_bloginfo( 'description', 'display' );
|
|
|
|
}
|
2016-01-20 16:02:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
endif;
|
|
|
|
|
2016-02-19 16:57:56 +00:00
|
|
|
return new Storefront_Customizer();
|