/includes/theme-support/class-wc-twenty-seventeen.php

  1. <?php 
  2. if ( ! defined( 'ABSPATH' ) ) { 
  3. exit; 
  4.  
  5. /** 
  6. * Twenty Seventeen suport. 
  7. * 
  8. * @class WC_Twenty_Seventeen 
  9. * @since 2.6.9 
  10. * @version 2.6.9 
  11. * @package WooCommerce/Classes 
  12. */ 
  13. class WC_Twenty_Seventeen { 
  14.  
  15. /** 
  16. * Theme init. 
  17. */ 
  18. public static function init() { 
  19. remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 ); 
  20. remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 ); 
  21.  
  22. add_action( 'woocommerce_before_main_content', array( __CLASS__, 'output_content_wrapper' ), 10 ); 
  23. add_action( 'woocommerce_after_main_content', array( __CLASS__, 'output_content_wrapper_end' ), 10 ); 
  24. add_filter( 'woocommerce_enqueue_styles', array( __CLASS__, 'enqueue_styles' ) ); 
  25.  
  26. /** 
  27. * Enqueue CSS for this theme. 
  28. * 
  29. * @param array $styles 
  30. * @return array 
  31. */ 
  32. public static function enqueue_styles( $styles ) { 
  33. unset( $styles['woocommerce-general'] ); 
  34.  
  35. $styles['woocommerce-twenty-seventeen'] = array( 
  36. 'src' => str_replace( array( 'http:', 'https:' ), '', WC()->plugin_url() ) . '/assets/css/twenty-seventeen.css',  
  37. 'deps' => '',  
  38. 'version' => WC_VERSION,  
  39. 'media' => 'all',  
  40. ); 
  41.  
  42. return apply_filters( 'woocommerce_twenty_seventeen_styles', $styles ); 
  43.  
  44. /** 
  45. * Open the Twenty Seventeen wrapper. 
  46. */ 
  47. public static function output_content_wrapper() { ?> 
  48. <div class="wrap"> 
  49. <div id="primary" class="content-area twentyseventeen"> 
  50. <main id="main" class="site-main" role="main"> 
  51. <?php 
  52.  
  53. /** 
  54. * Close the Twenty Seventeen wrapper. 
  55. */ 
  56. public static function output_content_wrapper_end() { ?> 
  57. </main> 
  58. </div> 
  59. <?php get_sidebar(); ?> 
  60. </div> 
  61. <?php 
  62.  
  63. WC_Twenty_Seventeen::init(); 
.