2016-11-25 15:17:13 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2017-07-10 05:56:28 +00:00
|
|
|
* Twenty Seventeen support.
|
2016-11-25 15:17:13 +00:00
|
|
|
*
|
2016-12-07 12:45:54 +00:00
|
|
|
* @since 2.6.9
|
2016-11-25 15:17:13 +00:00
|
|
|
* @package WooCommerce/Classes
|
|
|
|
*/
|
2018-01-25 17:03:01 +00:00
|
|
|
|
|
|
|
defined( 'ABSPATH' ) || exit;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* WC_Twenty_Seventeen class.
|
|
|
|
*/
|
2016-11-25 15:17:13 +00:00
|
|
|
class WC_Twenty_Seventeen {
|
|
|
|
|
|
|
|
/**
|
2017-02-24 12:41:15 +00:00
|
|
|
* Theme init.
|
2016-11-25 15:17:13 +00:00
|
|
|
*/
|
2017-02-24 19:10:34 +00:00
|
|
|
public static function init() {
|
2016-11-25 15:17:13 +00:00
|
|
|
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 );
|
|
|
|
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 );
|
|
|
|
|
2017-02-24 12:41:15 +00:00
|
|
|
add_action( 'woocommerce_before_main_content', array( __CLASS__, 'output_content_wrapper' ), 10 );
|
|
|
|
add_action( 'woocommerce_after_main_content', array( __CLASS__, 'output_content_wrapper_end' ), 10 );
|
|
|
|
add_filter( 'woocommerce_enqueue_styles', array( __CLASS__, 'enqueue_styles' ) );
|
2017-07-13 14:05:22 +00:00
|
|
|
add_filter( 'twentyseventeen_custom_colors_css', array( __CLASS__, 'custom_colors_css' ), 10, 3 );
|
2017-11-07 11:46:43 +00:00
|
|
|
|
|
|
|
add_theme_support( 'wc-product-gallery-zoom' );
|
|
|
|
add_theme_support( 'wc-product-gallery-lightbox' );
|
|
|
|
add_theme_support( 'wc-product-gallery-slider' );
|
|
|
|
add_theme_support( 'woocommerce', array(
|
2018-01-25 17:03:01 +00:00
|
|
|
'thumbnail_image_width' => 250,
|
|
|
|
'single_image_width' => 350,
|
2017-11-07 11:46:43 +00:00
|
|
|
) );
|
2016-11-25 15:17:13 +00:00
|
|
|
}
|
|
|
|
|
2016-12-07 12:45:54 +00:00
|
|
|
/**
|
|
|
|
* Enqueue CSS for this theme.
|
|
|
|
*
|
2017-11-07 11:46:43 +00:00
|
|
|
* @param array $styles Array of registered styles.
|
2016-12-07 12:45:54 +00:00
|
|
|
* @return array
|
|
|
|
*/
|
2017-02-24 12:41:15 +00:00
|
|
|
public static function enqueue_styles( $styles ) {
|
2016-11-25 15:17:13 +00:00
|
|
|
unset( $styles['woocommerce-general'] );
|
|
|
|
|
2018-04-05 16:02:06 +00:00
|
|
|
$styles['woocommerce-general'] = array(
|
2016-11-25 16:10:58 +00:00
|
|
|
'src' => str_replace( array( 'http:', 'https:' ), '', WC()->plugin_url() ) . '/assets/css/twenty-seventeen.css',
|
2016-11-25 15:17:13 +00:00
|
|
|
'deps' => '',
|
|
|
|
'version' => WC_VERSION,
|
|
|
|
'media' => 'all',
|
2018-05-31 09:34:08 +00:00
|
|
|
'has_rtl' => true,
|
2016-11-25 15:17:13 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
return apply_filters( 'woocommerce_twenty_seventeen_styles', $styles );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-12-07 12:45:54 +00:00
|
|
|
* Open the Twenty Seventeen wrapper.
|
2016-11-25 15:17:13 +00:00
|
|
|
*/
|
2017-11-07 12:11:37 +00:00
|
|
|
public static function output_content_wrapper() {
|
|
|
|
echo '<div class="wrap">';
|
|
|
|
echo '<div id="primary" class="content-area twentyseventeen">';
|
|
|
|
echo '<main id="main" class="site-main" role="main">';
|
2016-11-25 15:17:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-12-07 12:45:54 +00:00
|
|
|
* Close the Twenty Seventeen wrapper.
|
2016-11-25 15:17:13 +00:00
|
|
|
*/
|
2017-11-07 12:11:37 +00:00
|
|
|
public static function output_content_wrapper_end() {
|
|
|
|
echo '</main>';
|
|
|
|
echo '</div>';
|
|
|
|
get_sidebar();
|
|
|
|
echo '</div>';
|
2016-11-25 15:17:13 +00:00
|
|
|
}
|
2017-07-13 14:05:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom colors.
|
|
|
|
*
|
2017-11-07 11:46:43 +00:00
|
|
|
* @param string $css Styles.
|
|
|
|
* @param string $hue Color.
|
|
|
|
* @param string $saturation Saturation.
|
2017-07-13 14:05:22 +00:00
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public static function custom_colors_css( $css, $hue, $saturation ) {
|
|
|
|
$css .= '
|
|
|
|
.colors-custom .select2-container--default .select2-selection--single {
|
|
|
|
border-color: hsl( ' . $hue . ', ' . $saturation . ', 73% );
|
|
|
|
}
|
|
|
|
.colors-custom .select2-container--default .select2-selection__rendered {
|
|
|
|
color: hsl( ' . $hue . ', ' . $saturation . ', 40% );
|
|
|
|
}
|
|
|
|
.colors-custom .select2-container--default .select2-selection--single .select2-selection__arrow b {
|
|
|
|
border-color: hsl( ' . $hue . ', ' . $saturation . ', 40% ) transparent transparent transparent;
|
|
|
|
}
|
|
|
|
.colors-custom .select2-container--focus .select2-selection {
|
|
|
|
border-color: #000;
|
|
|
|
}
|
|
|
|
.colors-custom .select2-container--focus .select2-selection--single .select2-selection__arrow b {
|
|
|
|
border-color: #000 transparent transparent transparent;
|
|
|
|
}
|
|
|
|
.colors-custom .select2-container--focus .select2-selection .select2-selection__rendered {
|
|
|
|
color: #000;
|
|
|
|
}
|
|
|
|
';
|
|
|
|
return $css;
|
|
|
|
}
|
2016-11-25 15:17:13 +00:00
|
|
|
}
|
|
|
|
|
2017-02-24 12:41:15 +00:00
|
|
|
WC_Twenty_Seventeen::init();
|