class-wc-twenty-fifteen.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * Twenty Fifteen support.
  4. *
  5. * @class WC_Twenty_Fifteen
  6. * @since 3.3.0
  7. * @package WooCommerce/Classes
  8. */
  9. defined( 'ABSPATH' ) || exit;
  10. /**
  11. * WC_Twenty_Fifteen class.
  12. */
  13. class WC_Twenty_Fifteen {
  14. /**
  15. * Theme init.
  16. */
  17. public static function init() {
  18. // Remove default wrappers.
  19. remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper' );
  20. remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end' );
  21. // Add custom wrappers.
  22. add_action( 'woocommerce_before_main_content', array( __CLASS__, 'output_content_wrapper' ) );
  23. add_action( 'woocommerce_after_main_content', array( __CLASS__, 'output_content_wrapper_end' ) );
  24. // Declare theme support for features.
  25. add_theme_support( 'wc-product-gallery-zoom' );
  26. add_theme_support( 'wc-product-gallery-lightbox' );
  27. add_theme_support( 'wc-product-gallery-slider' );
  28. add_theme_support( 'woocommerce', array(
  29. 'thumbnail_image_width' => 200,
  30. 'single_image_width' => 350,
  31. ) );
  32. }
  33. /**
  34. * Open wrappers.
  35. */
  36. public static function output_content_wrapper() {
  37. echo '<div id="primary" role="main" class="content-area twentyfifteen"><div id="main" class="site-main t15wc">';
  38. }
  39. /**
  40. * Close wrappers.
  41. */
  42. public static function output_content_wrapper_end() {
  43. echo '</div></div>';
  44. }
  45. }
  46. WC_Twenty_Fifteen::init();