Add class to handle changes

This commit is contained in:
Mike Jolley 2017-11-14 12:08:57 +00:00
parent 387093cd27
commit 286d04153c
2 changed files with 61 additions and 1 deletions

View File

@ -0,0 +1,59 @@
<?php
/**
* Adds options to the customizer for WooCommerce.
*
* @version 3.3.0
* @package WooCommerce
* @author WooCommerce
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* WC_Customizer class.
*/
class WC_Customizer {
public function __construct() {
add_action( 'customize_register', array( $this, 'add_sections' ) );
}
/**
* Add settings to the customizer.
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
*/
public function add_sections( $wp_customize ) {
$wp_customize->add_section(
'woocommerce_display_settings',
array(
'title' => __( 'WooCommerce', 'woocommerce' ),
'priority' => 1000,
)
);
$wp_customize->add_setting(
'woocommerce_demo_store_notice',
array(
'default' => __( 'This is a demo store for testing purposes &mdash; no orders shall be fulfilled.', 'woocommerce' ),
'sanitize_callback' => 'wp_kses_post',
)
);
$wp_customize->add_control(
'control_name',
array(
'label' => __( 'Store notice', 'mytheme' ),
'description' => __( 'Shown at the top of your store above the header and visible to customers.', 'twentyfifteen' ),
'section' => 'woocommerce_display_settings',
'settings' => 'woocommerce_demo_store_notice',
'type' => 'textarea',
)
);
}
}
new WC_Customizer();

View File

@ -337,6 +337,7 @@ final class WooCommerce {
include_once( WC_ABSPATH . 'includes/class-wc-background-emailer.php' );
include_once( WC_ABSPATH . 'includes/class-wc-discounts.php' );
include_once( WC_ABSPATH . 'includes/class-wc-cart-totals.php' );
include_once( WC_ABSPATH . 'includes/class-wc-customizer.php' );
/**
* Data stores - used to store and retrieve CRUD object data from the database.
@ -398,7 +399,7 @@ final class WooCommerce {
}
/**
* Include classes sfor theme support.
* Include classes for theme support.
*
* @since 3.3.0
*/