add_section( 'business_store_lite' , array( 'title' => __( 'Go Premium Version', 'business-store' ), 'priority' => 1, ) ); $wp_customize->add_setting( 'business_store_lite', array( 'default' => null, 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( new business_store_pro_Control( $wp_customize, 'business_store_lite', array( 'label' => __( 'GO Premium', 'business-store' ), 'section' => 'business_store_lite', 'settings' => 'business_store_lite', 'priority' => 1, ) ) ); /******************* * Layout options. * *******************/ $wp_customize->add_section( 'layout_section' , array( 'title' => __('Layout', 'business-store' ), 'description'=> __('Change site layout. Change Single Post display layout, Default is two columns (with sidebar). In pages - use full width template to hide sidebar', 'business-store' ), ) ); // site layout default / box layout $wp_customize->add_setting( 'business_store_option[box_layout]' , array( 'default' => 0, 'sanitize_callback' => 'business_store_sanitize_checkbox', 'type'=>'option' )); $wp_customize->add_control('business_store_option[box_layout]' , array( 'label' => __('Enable box layout mode','business-store' ), 'description' => __('Enable or disable Box layout mode. Default is fluid layout.','business-store' ), 'section' => 'layout_section', 'type'=>'checkbox', ) ); // layout $wp_customize->add_setting( 'business_store_option[layout_section_post_one_column]' , array( 'default' => 0, 'sanitize_callback' => 'business_store_sanitize_checkbox', 'type'=>'option' )); $wp_customize->add_control('business_store_option[layout_section_post_one_column]' , array( 'label' => __('One Column Single Post Layout','business-store' ), 'description' => __('Display single post in one column (No Sidebar)','business-store' ), 'section' => 'layout_section', 'type'=>'checkbox', ) ); // sidebar position $wp_customize->add_setting( 'business_store_option[blog_sidebar_position]' , array( 'default' => 'right', 'sanitize_callback' => 'sanitize_text_field', 'type'=>'option' )); $wp_customize->add_control('business_store_option[blog_sidebar_position]' , array( 'label' => __('Sidebar position','business-store' ), 'section' => 'layout_section', 'type'=>'select', 'choices'=>array( 'right'=>__('Right Sidebar','business-store' ), 'left'=>__('Left Sidebar','business-store' ), ), ) ); /***************** * Theme options.* *****************/ $wp_customize->add_panel( 'theme_options', array( 'title' => __('Theme Options','business-store' ), 'description' => __('Theme specific customization options', 'business-store' ), // Include html tags such as
. 'priority' => 2, // Mixed with top-level-section hierarchy. ) ); //template settings require business_store_TEMPLATE_DIR.'/inc/customizer/header.php'; require business_store_TEMPLATE_DIR.'/inc/customizer/social.php'; // featured areas require business_store_TEMPLATE_DIR.'/inc/customizer/slider.php'; require business_store_TEMPLATE_DIR.'/inc/customizer/banner.php'; require business_store_TEMPLATE_DIR.'/inc/customizer/fonts.php'; require business_store_TEMPLATE_DIR.'/inc/customizer/footer.php'; /**************************** default customizer settings * *****************************/ $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; $wp_customize->selective_refresh->add_partial( 'blogname', array( 'selector' => '.site-title a', 'render_callback' => 'business_store_customize_partial_blogname', ) ); $wp_customize->selective_refresh->add_partial( 'blogdescription', array( 'selector' => '.site-description', 'render_callback' => 'business_store_customize_partial_blogdescription', ) ); // home header section enable/disable $wp_customize->add_setting( 'business_store_option[home_header_section_disable]' , array( 'default' => true, 'sanitize_callback' => 'business_store_sanitize_checkbox', 'type'=>'option' )); $wp_customize->add_control('business_store_option[home_header_section_disable]' , array( 'label' => __('Disable header when front page set to home-page template and product slider enabled.','business-store' ), 'section' => 'header_image', 'type'=>'checkbox', ) ); } /** * Render the site title for the selective refresh partial. * * @since business-store 1.0 * @see business_store_customize_register() * * @return void */ function business_store_customize_partial_blogname() { bloginfo( 'name' ); } /** * Render the site tagline for the selective refresh partial. * * @since business-store 1.0 * @see business_store_customize_register() * * @return void */ function business_store_customize_partial_blogdescription() { bloginfo( 'description' ); } /** * Return whether we're on a view that supports a one or two column layout. */ function business_store_is_view_with_layout_option() { // This option is available on all pages. It's also available on archives when there isn't a sidebar. return ( is_page() || ( is_archive() && ! is_active_sidebar( 'sidebar-1' ) ) ); } /** * Bind JS handlers to instantly live-preview changes. */ function business_store_customize_preview_js() { wp_enqueue_script( 'business-store-customize-preview', get_theme_file_uri( '/js/customize-preview.js' ), array( 'customize-preview' ), '1.0', true ); } add_action( 'customize_preview_init', 'business_store_customize_preview_js' ); /** * Load dynamic logic for the customizer controls area. */ function business_store_panels_js() { wp_enqueue_script( 'business-store-customize-controls', get_theme_file_uri( '/js/customize-controls.js' ), array(), '1.0', true ); } add_action( 'customize_controls_enqueue_scripts', 'business_store_panels_js' ); /** * A class to create a dropdown for all categories in your WordPress site */ if ( ! class_exists( 'WP_Customize_Control' ) ) return NULL; class business_store_category_dropdown_custom_control extends WP_Customize_Control { private $cats = false; public function __construct($manager, $id, $args = array(), $business_store_options = array()) { $this->cats = get_categories($business_store_options); parent::__construct( $manager, $id, $args ); } /** * Render the content of the category dropdown * @return HTML */ public function render_content() { if(!empty($this->cats)) { ?> manager->get_control( $setting->id )->choices; // If the input is a valid key, return it; otherwise, return the default. return ( array_key_exists( $input, $choices ) ? $input : $setting->default ); } /* * business-store sanitize checkbox function */ function business_store_sanitize_checkbox( $checked ) { // Boolean check. return ( ( isset( $checked ) && true == $checked ) ? true : false ); } /* * business-store get post categories */ $business_store_categories = business_store_get_post_categories(); /* * business-store get all published pages */ $business_store_all_posts = business_store_get_all_posts(); /* * business-store get product categories */ $business_store_product_categories = business_store_get_product_categories(); function business_store_get_product_categories(){ $args = array( 'taxonomy' => 'product_cat', 'orderby' => 'date', 'order' => 'ASC', 'show_count' => 1, 'pad_counts' => 0, 'hierarchical' => 0, 'title_li' => '', 'hide_empty' => 1, ); $cats = get_categories($args); $arr = array(); $arr['0'] = esc_html__('-Select Category-', 'business-store') ; foreach($cats as $cat){ $arr[$cat->term_id] = $cat->name; } return $arr; } function business_store_get_post_categories(){ $cats = get_categories(); $arr = array(); $arr['0'] = esc_html__('-Select Category-', 'business-store'); foreach($cats as $cat){ $arr[$cat->term_id] = $cat->name; } return $arr; } /* * business-store get all published pages */ function business_store_get_all_pages(){ $args = array( 'post_type' => 'page', 'sort_order' => 'asc', 'sort_column' => 'post_title', 'post_status' => 'publish' ); $pages = get_pages($args); $arr = array(); $arr[''] = '-- None --'; foreach($pages as $page){ $arr[$page->ID] = $page->post_title; } return $arr; } /* * business-store get all published posts */ function business_store_get_all_posts(){ $args = array( 'post_type' => 'post', 'sort_order' => 'desc', 'sort_column' => 'post_title', 'post_status' => 'publish' ); $posts = get_posts($args); $arr = array(); $arr[''] = '-- None --'; foreach($posts as $post){ $arr[$post->ID] = $post->post_title; } return $arr; } /* label control */ if (class_exists('WP_Customize_Control')) { class business_store_Label_Custom_control extends WP_Customize_Control { public function render_content() { ?>
label ); ?>