class-wc-twenty-eleven.php
5 years ago
class-wc-twenty-fifteen.php
5 years ago
class-wc-twenty-fourteen.php
5 years ago
class-wc-twenty-nineteen.php
5 years ago
class-wc-twenty-seventeen.php
5 years ago
class-wc-twenty-sixteen.php
5 years ago
class-wc-twenty-ten.php
5 years ago
class-wc-twenty-thirteen.php
5 years ago
class-wc-twenty-twelve.php
2 years ago
class-wc-twenty-twenty-one.php
5 years ago
class-wc-twenty-twenty-three.php
3 years ago
class-wc-twenty-twenty-two.php
4 years ago
class-wc-twenty-twenty.php
5 years ago
class-wc-twenty-twenty-one.php
87 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Twenty Twenty One support. |
| 4 | * |
| 5 | * @since 4.7.0 |
| 6 | * @package WooCommerce\Classes |
| 7 | */ |
| 8 | |
| 9 | use Automattic\Jetpack\Constants; |
| 10 | |
| 11 | defined( 'ABSPATH' ) || exit; |
| 12 | |
| 13 | /** |
| 14 | * WC_Twenty_Twenty_One class. |
| 15 | */ |
| 16 | class WC_Twenty_Twenty_One { |
| 17 | |
| 18 | /** |
| 19 | * Theme init. |
| 20 | */ |
| 21 | public static function init() { |
| 22 | |
| 23 | // Change WooCommerce wrappers. |
| 24 | remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 ); |
| 25 | remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 ); |
| 26 | |
| 27 | // This theme doesn't have a traditional sidebar. |
| 28 | remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 ); |
| 29 | |
| 30 | // Enqueue theme compatibility styles. |
| 31 | add_filter( 'woocommerce_enqueue_styles', array( __CLASS__, 'enqueue_styles' ) ); |
| 32 | |
| 33 | // Enqueue wp-admin compatibility styles. |
| 34 | add_action( 'admin_enqueue_scripts', array( __CLASS__, 'enqueue_admin_styles' ) ); |
| 35 | |
| 36 | // Register theme features. |
| 37 | add_theme_support( 'wc-product-gallery-zoom' ); |
| 38 | add_theme_support( 'wc-product-gallery-lightbox' ); |
| 39 | add_theme_support( 'wc-product-gallery-slider' ); |
| 40 | add_theme_support( |
| 41 | 'woocommerce', |
| 42 | array( |
| 43 | 'thumbnail_image_width' => 450, |
| 44 | 'single_image_width' => 600, |
| 45 | ) |
| 46 | ); |
| 47 | |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * Enqueue CSS for this theme. |
| 52 | * |
| 53 | * @param array $styles Array of registered styles. |
| 54 | * @return array |
| 55 | */ |
| 56 | public static function enqueue_styles( $styles ) { |
| 57 | unset( $styles['woocommerce-general'] ); |
| 58 | |
| 59 | $styles['woocommerce-general'] = array( |
| 60 | 'src' => str_replace( array( 'http:', 'https:' ), '', WC()->plugin_url() ) . '/assets/css/twenty-twenty-one.css', |
| 61 | 'deps' => '', |
| 62 | 'version' => Constants::get_constant( 'WC_VERSION' ), |
| 63 | 'media' => 'all', |
| 64 | 'has_rtl' => true, |
| 65 | ); |
| 66 | |
| 67 | return apply_filters( 'woocommerce_twenty_twenty_one_styles', $styles ); |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * Enqueue the wp-admin CSS overrides for this theme. |
| 72 | */ |
| 73 | public static function enqueue_admin_styles() { |
| 74 | wp_enqueue_style( |
| 75 | 'woocommerce-twenty-twenty-one-admin', |
| 76 | str_replace( array( 'http:', 'https:' ), '', WC()->plugin_url() ) . '/assets/css/twenty-twenty-one-admin.css', |
| 77 | '', |
| 78 | Constants::get_constant( 'WC_VERSION' ), |
| 79 | 'all' |
| 80 | ); |
| 81 | } |
| 82 | |
| 83 | |
| 84 | } |
| 85 | |
| 86 | WC_Twenty_Twenty_One::init(); |
| 87 |