Added basic declaration for WC support to Twentytwenty.
This commit is contained in:
parent
8675e26c28
commit
bc04b8f45b
|
@ -0,0 +1,39 @@
|
|||
@import "mixins";
|
||||
|
||||
/**
|
||||
* Sass variables
|
||||
*/
|
||||
|
||||
$headings: -apple-system, blinkmacsystemfont, "Helvetica Neue", helvetica, sans-serif;
|
||||
$body: nonbreakingspaceoverride, "Hoefler Text", garamond, "Times New Roman", serif;
|
||||
|
||||
$body-color: #111;
|
||||
$highlights-color: #cd2653;
|
||||
|
||||
/**
|
||||
* Fonts
|
||||
*/
|
||||
@font-face {
|
||||
font-family: star;
|
||||
src: url(../fonts/star.eot);
|
||||
src:
|
||||
url(../fonts/star.eot?#iefix) format("embedded-opentype"),
|
||||
url(../fonts/star.woff) format("woff"),
|
||||
url(../fonts/star.ttf) format("truetype"),
|
||||
url(../fonts/star.svg#star) format("svg");
|
||||
font-weight: 400;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: WooCommerce;
|
||||
src: url(../fonts/WooCommerce.eot);
|
||||
src:
|
||||
url(../fonts/WooCommerce.eot?#iefix) format("embedded-opentype"),
|
||||
url(../fonts/WooCommerce.woff) format("woff"),
|
||||
url(../fonts/WooCommerce.ttf) format("truetype"),
|
||||
url(../fonts/WooCommerce.svg#WooCommerce) format("svg");
|
||||
font-weight: 400;
|
||||
font-style: normal;
|
||||
}
|
||||
|
|
@ -473,7 +473,7 @@ final class WooCommerce {
|
|||
* @since 3.3.0
|
||||
*/
|
||||
private function theme_support_includes() {
|
||||
if ( wc_is_active_theme( array( 'twentynineteen', 'twentyseventeen', 'twentysixteen', 'twentyfifteen', 'twentyfourteen', 'twentythirteen', 'twentyeleven', 'twentytwelve', 'twentyten' ) ) ) {
|
||||
if ( wc_is_active_theme( array( 'twentytwenty', 'twentynineteen', 'twentyseventeen', 'twentysixteen', 'twentyfifteen', 'twentyfourteen', 'twentythirteen', 'twentyeleven', 'twentytwelve', 'twentyten' ) ) ) {
|
||||
switch ( get_template() ) {
|
||||
case 'twentyten':
|
||||
include_once WC_ABSPATH . 'includes/theme-support/class-wc-twenty-ten.php';
|
||||
|
@ -502,6 +502,9 @@ final class WooCommerce {
|
|||
case 'twentynineteen':
|
||||
include_once WC_ABSPATH . 'includes/theme-support/class-wc-twenty-nineteen.php';
|
||||
break;
|
||||
case 'twentytwenty':
|
||||
include_once WC_ABSPATH . 'includes/theme-support/class-wc-twenty-twenty.php';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
<?php
|
||||
/**
|
||||
* Twenty Twenty support.
|
||||
*
|
||||
* @since 3.8.1
|
||||
* @package WooCommerce/Classes
|
||||
*/
|
||||
|
||||
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' => 300,
|
||||
'single_image_width' => 450,
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 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>';
|
||||
}
|
||||
|
||||
/**
|
||||
* 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' => WC_VERSION,
|
||||
'media' => 'all',
|
||||
'has_rtl' => true,
|
||||
);
|
||||
|
||||
return apply_filters( 'woocommerce_twenty_twenty_styles', $styles );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
WC_Twenty_Twenty::init();
|
Loading…
Reference in New Issue