initial commit
This commit is contained in:
56
includes/theme-support/class-wc-twenty-eleven.php
Normal file
56
includes/theme-support/class-wc-twenty-eleven.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* Twenty Eleven support.
|
||||
*
|
||||
* @since 3.3.0
|
||||
* @package WooCommerce\Classes
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* WC_Twenty_Eleven class.
|
||||
*/
|
||||
class WC_Twenty_Eleven {
|
||||
|
||||
/**
|
||||
* Theme init.
|
||||
*/
|
||||
public static function init() {
|
||||
// Remove default wrappers.
|
||||
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper' );
|
||||
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end' );
|
||||
|
||||
// Add custom wrappers.
|
||||
add_action( 'woocommerce_before_main_content', array( __CLASS__, 'output_content_wrapper' ) );
|
||||
add_action( 'woocommerce_after_main_content', array( __CLASS__, 'output_content_wrapper_end' ) );
|
||||
|
||||
// Declare theme support for features.
|
||||
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(
|
||||
'thumbnail_image_width' => 150,
|
||||
'single_image_width' => 300,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Open wrappers.
|
||||
*/
|
||||
public static function output_content_wrapper() {
|
||||
echo '<div id="primary"><div id="content" role="main" class="twentyeleven">';
|
||||
}
|
||||
|
||||
/**
|
||||
* Close wrappers.
|
||||
*/
|
||||
public static function output_content_wrapper_end() {
|
||||
echo '</div></div>';
|
||||
}
|
||||
}
|
||||
|
||||
WC_Twenty_Eleven::init();
|
57
includes/theme-support/class-wc-twenty-fifteen.php
Normal file
57
includes/theme-support/class-wc-twenty-fifteen.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* Twenty Fifteen support.
|
||||
*
|
||||
* @class WC_Twenty_Fifteen
|
||||
* @since 3.3.0
|
||||
* @package WooCommerce\Classes
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* WC_Twenty_Fifteen class.
|
||||
*/
|
||||
class WC_Twenty_Fifteen {
|
||||
|
||||
/**
|
||||
* Theme init.
|
||||
*/
|
||||
public static function init() {
|
||||
// Remove default wrappers.
|
||||
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper' );
|
||||
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end' );
|
||||
|
||||
// Add custom wrappers.
|
||||
add_action( 'woocommerce_before_main_content', array( __CLASS__, 'output_content_wrapper' ) );
|
||||
add_action( 'woocommerce_after_main_content', array( __CLASS__, 'output_content_wrapper_end' ) );
|
||||
|
||||
// Declare theme support for features.
|
||||
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(
|
||||
'thumbnail_image_width' => 200,
|
||||
'single_image_width' => 350,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Open wrappers.
|
||||
*/
|
||||
public static function output_content_wrapper() {
|
||||
echo '<div id="primary" role="main" class="content-area twentyfifteen"><div id="main" class="site-main t15wc">';
|
||||
}
|
||||
|
||||
/**
|
||||
* Close wrappers.
|
||||
*/
|
||||
public static function output_content_wrapper_end() {
|
||||
echo '</div></div>';
|
||||
}
|
||||
}
|
||||
|
||||
WC_Twenty_Fifteen::init();
|
58
includes/theme-support/class-wc-twenty-fourteen.php
Normal file
58
includes/theme-support/class-wc-twenty-fourteen.php
Normal file
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/**
|
||||
* Twenty Fourteen support.
|
||||
*
|
||||
* @class WC_Twenty_Fourteen
|
||||
* @since 3.3.0
|
||||
* @package WooCommerce\Classes
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* WC_Twenty_Fourteen class.
|
||||
*/
|
||||
class WC_Twenty_Fourteen {
|
||||
|
||||
/**
|
||||
* Theme init.
|
||||
*/
|
||||
public static function init() {
|
||||
// Remove default wrappers.
|
||||
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper' );
|
||||
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end' );
|
||||
|
||||
// Add custom wrappers.
|
||||
add_action( 'woocommerce_before_main_content', array( __CLASS__, 'output_content_wrapper' ) );
|
||||
add_action( 'woocommerce_after_main_content', array( __CLASS__, 'output_content_wrapper_end' ) );
|
||||
|
||||
// Declare theme support for features.
|
||||
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(
|
||||
'thumbnail_image_width' => 150,
|
||||
'single_image_width' => 300,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Open wrappers.
|
||||
*/
|
||||
public static function output_content_wrapper() {
|
||||
echo '<div id="primary" class="content-area"><div id="content" role="main" class="site-content twentyfourteen"><div class="tfwc">';
|
||||
}
|
||||
|
||||
/**
|
||||
* Close wrappers.
|
||||
*/
|
||||
public static function output_content_wrapper_end() {
|
||||
echo '</div></div></div>';
|
||||
get_sidebar( 'content' );
|
||||
}
|
||||
}
|
||||
|
||||
WC_Twenty_Fourteen::init();
|
132
includes/theme-support/class-wc-twenty-nineteen.php
Normal file
132
includes/theme-support/class-wc-twenty-nineteen.php
Normal file
@ -0,0 +1,132 @@
|
||||
<?php
|
||||
/**
|
||||
* Twenty Nineteen support.
|
||||
*
|
||||
* @since 3.5.X
|
||||
* @package WooCommerce\Classes
|
||||
*/
|
||||
|
||||
use Automattic\Jetpack\Constants;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* WC_Twenty_Nineteen class.
|
||||
*/
|
||||
class WC_Twenty_Nineteen {
|
||||
|
||||
/**
|
||||
* Theme init.
|
||||
*/
|
||||
public static function init() {
|
||||
|
||||
// Change WooCommerce wrappers.
|
||||
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 );
|
||||
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 );
|
||||
|
||||
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 );
|
||||
|
||||
// This theme doesn't have a traditional sidebar.
|
||||
remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 );
|
||||
|
||||
// Enqueue theme compatibility styles.
|
||||
add_filter( 'woocommerce_enqueue_styles', array( __CLASS__, 'enqueue_styles' ) );
|
||||
|
||||
// Register theme features.
|
||||
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(
|
||||
'thumbnail_image_width' => 300,
|
||||
'single_image_width' => 450,
|
||||
)
|
||||
);
|
||||
|
||||
// Tweak Twenty Nineteen features.
|
||||
add_action( 'wp', array( __CLASS__, 'tweak_theme_features' ) );
|
||||
|
||||
// Color scheme CSS.
|
||||
add_filter( 'twentynineteen_custom_colors_css', array( __CLASS__, 'custom_colors_css' ), 10, 3 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Open the Twenty Nineteen wrapper.
|
||||
*/
|
||||
public static function output_content_wrapper() {
|
||||
echo '<section id="primary" class="content-area">';
|
||||
echo '<main id="main" class="site-main">';
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the Twenty Nineteen wrapper.
|
||||
*/
|
||||
public static function output_content_wrapper_end() {
|
||||
echo '</main>';
|
||||
echo '</section>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue CSS for this theme.
|
||||
*
|
||||
* @param array $styles Array of registered styles.
|
||||
* @return array
|
||||
*/
|
||||
public static function enqueue_styles( $styles ) {
|
||||
unset( $styles['woocommerce-general'] );
|
||||
|
||||
$styles['woocommerce-general'] = array(
|
||||
'src' => str_replace( array( 'http:', 'https:' ), '', WC()->plugin_url() ) . '/assets/css/twenty-nineteen.css',
|
||||
'deps' => '',
|
||||
'version' => Constants::get_constant( 'WC_VERSION' ),
|
||||
'media' => 'all',
|
||||
'has_rtl' => true,
|
||||
);
|
||||
|
||||
return apply_filters( 'woocommerce_twenty_nineteen_styles', $styles );
|
||||
}
|
||||
|
||||
/**
|
||||
* Tweak Twenty Nineteen features.
|
||||
*/
|
||||
public static function tweak_theme_features() {
|
||||
if ( is_woocommerce() ) {
|
||||
add_filter( 'twentynineteen_can_show_post_thumbnail', '__return_false' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters Twenty Nineteen custom colors CSS.
|
||||
*
|
||||
* @param string $css Base theme colors CSS.
|
||||
* @param int $primary_color The user's selected color hue.
|
||||
* @param string $saturation Filtered theme color saturation level.
|
||||
*/
|
||||
public static function custom_colors_css( $css, $primary_color, $saturation ) {
|
||||
if ( function_exists( 'register_block_type' ) && is_admin() ) {
|
||||
return $css;
|
||||
}
|
||||
|
||||
$lightness = absint( apply_filters( 'twentynineteen_custom_colors_lightness', 33 ) );
|
||||
$lightness = $lightness . '%';
|
||||
|
||||
$css .= '
|
||||
.onsale,
|
||||
.woocommerce-info,
|
||||
.woocommerce-store-notice {
|
||||
background-color: hsl( ' . $primary_color . ', ' . $saturation . ', ' . $lightness . ' );
|
||||
}
|
||||
|
||||
.woocommerce-tabs ul li.active a {
|
||||
color: hsl( ' . $primary_color . ', ' . $saturation . ', ' . $lightness . ' );
|
||||
box-shadow: 0 2px 0 hsl( ' . $primary_color . ', ' . $saturation . ', ' . $lightness . ' );
|
||||
}
|
||||
';
|
||||
|
||||
return $css;
|
||||
}
|
||||
}
|
||||
|
||||
WC_Twenty_Nineteen::init();
|
114
includes/theme-support/class-wc-twenty-seventeen.php
Normal file
114
includes/theme-support/class-wc-twenty-seventeen.php
Normal file
@ -0,0 +1,114 @@
|
||||
<?php
|
||||
/**
|
||||
* Twenty Seventeen support.
|
||||
*
|
||||
* @since 2.6.9
|
||||
* @package WooCommerce\Classes
|
||||
*/
|
||||
|
||||
use Automattic\Jetpack\Constants;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* WC_Twenty_Seventeen class.
|
||||
*/
|
||||
class WC_Twenty_Seventeen {
|
||||
|
||||
/**
|
||||
* Theme init.
|
||||
*/
|
||||
public static function init() {
|
||||
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 );
|
||||
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 );
|
||||
|
||||
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' ) );
|
||||
add_filter( 'twentyseventeen_custom_colors_css', array( __CLASS__, 'custom_colors_css' ), 10, 3 );
|
||||
|
||||
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(
|
||||
'thumbnail_image_width' => 250,
|
||||
'single_image_width' => 350,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue CSS for this theme.
|
||||
*
|
||||
* @param array $styles Array of registered styles.
|
||||
* @return array
|
||||
*/
|
||||
public static function enqueue_styles( $styles ) {
|
||||
unset( $styles['woocommerce-general'] );
|
||||
|
||||
$styles['woocommerce-general'] = array(
|
||||
'src' => str_replace( array( 'http:', 'https:' ), '', WC()->plugin_url() ) . '/assets/css/twenty-seventeen.css',
|
||||
'deps' => '',
|
||||
'version' => Constants::get_constant( 'WC_VERSION' ),
|
||||
'media' => 'all',
|
||||
'has_rtl' => true,
|
||||
);
|
||||
|
||||
return apply_filters( 'woocommerce_twenty_seventeen_styles', $styles );
|
||||
}
|
||||
|
||||
/**
|
||||
* Open the Twenty Seventeen wrapper.
|
||||
*/
|
||||
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">';
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the Twenty Seventeen wrapper.
|
||||
*/
|
||||
public static function output_content_wrapper_end() {
|
||||
echo '</main>';
|
||||
echo '</div>';
|
||||
get_sidebar();
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom colors.
|
||||
*
|
||||
* @param string $css Styles.
|
||||
* @param string $hue Color.
|
||||
* @param string $saturation Saturation.
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
|
||||
WC_Twenty_Seventeen::init();
|
56
includes/theme-support/class-wc-twenty-sixteen.php
Normal file
56
includes/theme-support/class-wc-twenty-sixteen.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* Twenty Sixteen support.
|
||||
*
|
||||
* @since 3.3.0
|
||||
* @package WooCommerce\Classes
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* WC_Twenty_Sixteen class.
|
||||
*/
|
||||
class WC_Twenty_Sixteen {
|
||||
|
||||
/**
|
||||
* Theme init.
|
||||
*/
|
||||
public static function init() {
|
||||
// Remove default wrappers.
|
||||
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper' );
|
||||
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end' );
|
||||
|
||||
// Add custom wrappers.
|
||||
add_action( 'woocommerce_before_main_content', array( __CLASS__, 'output_content_wrapper' ) );
|
||||
add_action( 'woocommerce_after_main_content', array( __CLASS__, 'output_content_wrapper_end' ) );
|
||||
|
||||
// Declare theme support for features.
|
||||
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(
|
||||
'thumbnail_image_width' => 250,
|
||||
'single_image_width' => 400,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Open wrappers.
|
||||
*/
|
||||
public static function output_content_wrapper() {
|
||||
echo '<div id="primary" class="content-area twentysixteen"><main id="main" class="site-main" role="main">';
|
||||
}
|
||||
|
||||
/**
|
||||
* Close wrappers.
|
||||
*/
|
||||
public static function output_content_wrapper_end() {
|
||||
echo '</main></div>';
|
||||
}
|
||||
}
|
||||
|
||||
WC_Twenty_Sixteen::init();
|
56
includes/theme-support/class-wc-twenty-ten.php
Normal file
56
includes/theme-support/class-wc-twenty-ten.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* Twenty Ten support.
|
||||
*
|
||||
* @since 3.3.0
|
||||
* @package WooCommerce\Classes
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* WC_Twenty_Ten class.
|
||||
*/
|
||||
class WC_Twenty_Ten {
|
||||
|
||||
/**
|
||||
* Theme init.
|
||||
*/
|
||||
public static function init() {
|
||||
// Remove default wrappers.
|
||||
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper' );
|
||||
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end' );
|
||||
|
||||
// Add custom wrappers.
|
||||
add_action( 'woocommerce_before_main_content', array( __CLASS__, 'output_content_wrapper' ) );
|
||||
add_action( 'woocommerce_after_main_content', array( __CLASS__, 'output_content_wrapper_end' ) );
|
||||
|
||||
// Declare theme support for features.
|
||||
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(
|
||||
'thumbnail_image_width' => 200,
|
||||
'single_image_width' => 300,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Open wrappers.
|
||||
*/
|
||||
public static function output_content_wrapper() {
|
||||
echo '<div id="container"><div id="content" role="main">';
|
||||
}
|
||||
|
||||
/**
|
||||
* Close wrappers.
|
||||
*/
|
||||
public static function output_content_wrapper_end() {
|
||||
echo '</div></div>';
|
||||
}
|
||||
}
|
||||
|
||||
WC_Twenty_Ten::init();
|
57
includes/theme-support/class-wc-twenty-thirteen.php
Normal file
57
includes/theme-support/class-wc-twenty-thirteen.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* Twenty Thirteen support.
|
||||
*
|
||||
* @class WC_Twenty_Thirteen
|
||||
* @since 3.3.0
|
||||
* @package WooCommerce\Classes
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* WC_Twenty_Thirteen class.
|
||||
*/
|
||||
class WC_Twenty_Thirteen {
|
||||
|
||||
/**
|
||||
* Theme init.
|
||||
*/
|
||||
public static function init() {
|
||||
// Remove default wrappers.
|
||||
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper' );
|
||||
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end' );
|
||||
|
||||
// Add custom wrappers.
|
||||
add_action( 'woocommerce_before_main_content', array( __CLASS__, 'output_content_wrapper' ) );
|
||||
add_action( 'woocommerce_after_main_content', array( __CLASS__, 'output_content_wrapper_end' ) );
|
||||
|
||||
// Declare theme support for features.
|
||||
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(
|
||||
'thumbnail_image_width' => 200,
|
||||
'single_image_width' => 300,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Open wrappers.
|
||||
*/
|
||||
public static function output_content_wrapper() {
|
||||
echo '<div id="primary" class="site-content"><div id="content" role="main" class="entry-content twentythirteen">';
|
||||
}
|
||||
|
||||
/**
|
||||
* Close wrappers.
|
||||
*/
|
||||
public static function output_content_wrapper_end() {
|
||||
echo '</div></div>';
|
||||
}
|
||||
}
|
||||
|
||||
WC_Twenty_Thirteen::init();
|
57
includes/theme-support/class-wc-twenty-twelve.php
Normal file
57
includes/theme-support/class-wc-twenty-twelve.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* Twenty Twelve support.
|
||||
*
|
||||
* @class WC_Twenty_Twelve
|
||||
* @since 3.3.0
|
||||
* @package WooCommerce\Classes
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* WC_Twenty_Twelve class.
|
||||
*/
|
||||
class WC_Twenty_Twelve {
|
||||
|
||||
/**
|
||||
* Theme init.
|
||||
*/
|
||||
public static function init() {
|
||||
// Remove default wrappers.
|
||||
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper' );
|
||||
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end' );
|
||||
|
||||
// Add custom wrappers.
|
||||
add_action( 'woocommerce_before_main_content', array( __CLASS__, 'output_content_wrapper' ) );
|
||||
add_action( 'woocommerce_after_main_content', array( __CLASS__, 'output_content_wrapper_end' ) );
|
||||
|
||||
// Declare theme support for features.
|
||||
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(
|
||||
'thumbnail_image_width' => 200,
|
||||
'single_image_width' => 300,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Open wrappers.
|
||||
*/
|
||||
public static function output_content_wrapper() {
|
||||
echo '<div id="primary" class="site-content"><div id="content" role="main" class="twentytwelve">';
|
||||
}
|
||||
|
||||
/**
|
||||
* Close wrappers.
|
||||
*/
|
||||
public static function output_content_wrapper_end() {
|
||||
echo '</div></div>';
|
||||
}
|
||||
}
|
||||
|
||||
WC_Twenty_Twelve::init();
|
86
includes/theme-support/class-wc-twenty-twenty-one.php
Normal file
86
includes/theme-support/class-wc-twenty-twenty-one.php
Normal file
@ -0,0 +1,86 @@
|
||||
<?php
|
||||
/**
|
||||
* Twenty Twenty One support.
|
||||
*
|
||||
* @since 4.7.0
|
||||
* @package WooCommerce\Classes
|
||||
*/
|
||||
|
||||
use Automattic\Jetpack\Constants;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* WC_Twenty_Twenty_One class.
|
||||
*/
|
||||
class WC_Twenty_Twenty_One {
|
||||
|
||||
/**
|
||||
* Theme init.
|
||||
*/
|
||||
public static function init() {
|
||||
|
||||
// Change WooCommerce wrappers.
|
||||
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 );
|
||||
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 );
|
||||
|
||||
// This theme doesn't have a traditional sidebar.
|
||||
remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 );
|
||||
|
||||
// Enqueue theme compatibility styles.
|
||||
add_filter( 'woocommerce_enqueue_styles', array( __CLASS__, 'enqueue_styles' ) );
|
||||
|
||||
// Enqueue wp-admin compatibility styles.
|
||||
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'enqueue_admin_styles' ) );
|
||||
|
||||
// Register theme features.
|
||||
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(
|
||||
'thumbnail_image_width' => 450,
|
||||
'single_image_width' => 600,
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue CSS for this theme.
|
||||
*
|
||||
* @param array $styles Array of registered styles.
|
||||
* @return array
|
||||
*/
|
||||
public static function enqueue_styles( $styles ) {
|
||||
unset( $styles['woocommerce-general'] );
|
||||
|
||||
$styles['woocommerce-general'] = array(
|
||||
'src' => str_replace( array( 'http:', 'https:' ), '', WC()->plugin_url() ) . '/assets/css/twenty-twenty-one.css',
|
||||
'deps' => '',
|
||||
'version' => Constants::get_constant( 'WC_VERSION' ),
|
||||
'media' => 'all',
|
||||
'has_rtl' => true,
|
||||
);
|
||||
|
||||
return apply_filters( 'woocommerce_twenty_twenty_one_styles', $styles );
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue the wp-admin CSS overrides for this theme.
|
||||
*/
|
||||
public static function enqueue_admin_styles() {
|
||||
wp_enqueue_style(
|
||||
'woocommerce-twenty-twenty-one-admin',
|
||||
str_replace( array( 'http:', 'https:' ), '', WC()->plugin_url() ) . '/assets/css/twenty-twenty-one-admin.css',
|
||||
'',
|
||||
Constants::get_constant( 'WC_VERSION' ),
|
||||
'all'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
WC_Twenty_Twenty_One::init();
|
107
includes/theme-support/class-wc-twenty-twenty.php
Normal file
107
includes/theme-support/class-wc-twenty-twenty.php
Normal file
@ -0,0 +1,107 @@
|
||||
<?php
|
||||
/**
|
||||
* Twenty Twenty support.
|
||||
*
|
||||
* @since 3.8.1
|
||||
* @package WooCommerce\Classes
|
||||
*/
|
||||
|
||||
use Automattic\Jetpack\Constants;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* WC_Twenty_Twenty class.
|
||||
*/
|
||||
class WC_Twenty_Twenty {
|
||||
|
||||
/**
|
||||
* Theme init.
|
||||
*/
|
||||
public static function init() {
|
||||
|
||||
// Change WooCommerce wrappers.
|
||||
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 );
|
||||
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 );
|
||||
|
||||
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 );
|
||||
|
||||
// This theme doesn't have a traditional sidebar.
|
||||
remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 );
|
||||
|
||||
// Enqueue theme compatibility styles.
|
||||
add_filter( 'woocommerce_enqueue_styles', array( __CLASS__, 'enqueue_styles' ) );
|
||||
|
||||
// Register theme features.
|
||||
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(
|
||||
'thumbnail_image_width' => 450,
|
||||
'single_image_width' => 600,
|
||||
)
|
||||
);
|
||||
|
||||
// Background color change.
|
||||
add_action( 'after_setup_theme', array( __CLASS__, 'set_white_background' ), 10 );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Open the Twenty Twenty wrapper.
|
||||
*/
|
||||
public static function output_content_wrapper() {
|
||||
echo '<section id="primary" class="content-area">';
|
||||
echo '<main id="main" class="site-main">';
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the Twenty Twenty wrapper.
|
||||
*/
|
||||
public static function output_content_wrapper_end() {
|
||||
echo '</main>';
|
||||
echo '</section>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Set background color to white if it's default, otherwise don't touch it.
|
||||
*/
|
||||
public static function set_white_background() {
|
||||
$background = sanitize_hex_color_no_hash( get_theme_mod( 'background_color' ) );
|
||||
$background_default = 'f5efe0';
|
||||
|
||||
// Don't change user's choice of background color.
|
||||
if ( ! empty( $background ) && $background !== $background_default ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// In case default background is found, change it to white.
|
||||
set_theme_mod( 'background_color', 'fff' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue CSS for this theme.
|
||||
*
|
||||
* @param array $styles Array of registered styles.
|
||||
* @return array
|
||||
*/
|
||||
public static function enqueue_styles( $styles ) {
|
||||
unset( $styles['woocommerce-general'] );
|
||||
|
||||
$styles['woocommerce-general'] = array(
|
||||
'src' => str_replace( array( 'http:', 'https:' ), '', WC()->plugin_url() ) . '/assets/css/twenty-twenty.css',
|
||||
'deps' => '',
|
||||
'version' => Constants::get_constant( 'WC_VERSION' ),
|
||||
'media' => 'all',
|
||||
'has_rtl' => true,
|
||||
);
|
||||
|
||||
return apply_filters( 'woocommerce_twenty_twenty_styles', $styles );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
WC_Twenty_Twenty::init();
|
Reference in New Issue
Block a user