get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; if ( isset( $wp_customize->selective_refresh ) ) { $wp_customize->selective_refresh->add_partial( 'blogname', array( 'selector' => '.site-title a', 'render_callback' => 'bizmark_customize_partial_blogname', ) ); $wp_customize->selective_refresh->add_partial( 'blogdescription', array( 'selector' => '.site-description', 'render_callback' => 'bizmark_customize_partial_blogdescription', ) ); } $wp_customize->add_panel( 'bizmark_general', array( 'priority' => 10, 'capability' => 'edit_theme_options', 'title' => __('General Settings', 'bizmark'), 'active_callback' => '', ) ); $wp_customize->get_section( 'title_tagline' )->panel = 'bizmark_general'; $wp_customize->get_section( 'background_image' )->panel = 'bizmark_general'; $wp_customize->get_section( 'background_image' )->title = __('Site background', 'bizmark'); $wp_customize->get_section( 'header_image' )->panel = 'bizmark_general'; $wp_customize->get_section( 'static_front_page' )->panel = 'business_page'; $wp_customize->get_section( 'static_front_page' )->title = __('Select frontpage type', 'bizmark'); $wp_customize->get_section( 'static_front_page' )->priority = 9; $wp_customize->remove_section('colors'); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'background_color', array( 'label' => __( 'Background Color', 'bizmark' ), 'section' => 'background_image', 'priority' => 9 ) ) ); //$wp_customize->remove_section('static_front_page'); //$wp_customize->remove_section('header_image'); /* Upgrade */ $wp_customize->add_section( 'business_upgrade', array( 'priority' => 8, 'capability' => 'edit_theme_options', 'title' => __('Upgrade to PRO', 'bizmark'), 'active_callback' => '', ) ); $wp_customize->add_setting( 'bizmark_show_sliderr', array( 'default' => 'select', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( new bizmark_Customize_Control_Upgrade( $wp_customize, 'bizmark_show_sliderr', array( 'label' => __( 'Show headerr?', 'bizmark' ), 'settings' => 'bizmark_show_sliderr', 'priority' => 10, 'section' => 'business_upgrade', 'choices' => '', 'input_attrs' => 'yes', 'active_callback' => '' ) ) ); /* Usage guide */ $wp_customize->add_section( 'business_usage', array( 'priority' => 9, 'capability' => 'edit_theme_options', 'title' => __('Theme Usage Guide', 'bizmark'), 'active_callback' => '', ) ); $wp_customize->add_setting( 'bizmark_show_sliderrr', array( 'default' => 'select', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( new bizmark_Customize_Control_Guide( $wp_customize, 'bizmark_show_sliderrr', array( 'label' => __( 'Show headerr?', 'bizmark' ), 'settings' => 'bizmark_show_sliderrr', 'priority' => 10, 'section' => 'business_usage', 'choices' => '', 'input_attrs' => 'yes', 'active_callback' => '' ) ) ); /* Business page panel */ $wp_customize->add_panel( 'business_page', array( 'priority' => 20, 'capability' => 'edit_theme_options', 'title' => __('Home/Front Page Settings', 'bizmark'), 'active_callback' => '', ) ); /* Header options */ $wp_customize->add_section( 'business_page_header', array( 'priority' => 10, 'capability' => 'edit_theme_options', 'title' => __('Header Settings', 'bizmark'), 'active_callback' => 'bizmark_front_page_sections', 'panel' => 'business_page', ) ); $wp_customize->add_setting( 'bizmark_show_slider', array( 'default' => 'select', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bizmark_sanitize_yes_no_setting', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'bizmark_show_slider', array( 'label' => __( 'Show header?', 'bizmark' ), 'settings' => 'bizmark_show_slider', 'priority' => 10, 'section' => 'business_page_header', 'type' => 'select', 'choices' => $bizmarkYesNo, ) ) ); $wp_customize->add_setting( 'bizmark_slider_post', array( 'default' => 'select', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bizmark_sanitize_post_selection', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'bizmark_slider_post', array( 'label' => __( 'Select post', 'bizmark' ), 'description' => __( 'Select a post/page you want to show in header', 'bizmark' ), 'settings' => 'bizmark_slider_post', 'priority' => 20, 'section' => 'business_page_header', 'type' => 'select', 'choices' => $bizmarkPostsPagesArray, ) ) ); /* Welcome options */ $wp_customize->add_section( 'business_page_welcome', array( 'priority' => 20, 'capability' => 'edit_theme_options', 'title' => __('Welcome Settings', 'bizmark'), 'active_callback' => 'bizmark_front_page_sections', 'panel' => 'business_page', ) ); $wp_customize->add_setting( 'bizmark_show_welcome', array( 'default' => 'select', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bizmark_sanitize_yes_no_setting', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'bizmark_show_welcome', array( 'label' => __( 'Show welcome?', 'bizmark' ), 'settings' => 'bizmark_show_welcome', 'priority' => 10, 'section' => 'business_page_welcome', 'type' => 'select', 'choices' => $bizmarkYesNo, ) ) ); $wp_customize->add_setting( 'bizmark_welcome_post', array( 'default' => 'select', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bizmark_sanitize_post_selection', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'bizmark_welcome_post', array( 'label' => __( 'Select post', 'bizmark' ), 'description' => __( 'Select a post/page you want to show in welcome section', 'bizmark' ), 'settings' => 'bizmark_welcome_post', 'priority' => 20, 'section' => 'business_page_welcome', 'type' => 'select', 'choices' => $bizmarkPostsPagesArray, ) ) ); /* Products options */ $wp_customize->add_section( 'business_page_services', array( 'priority' => 30, 'capability' => 'edit_theme_options', 'title' => __('Services Settings', 'bizmark'), 'active_callback' => 'bizmark_front_page_sections', 'panel' => 'business_page', ) ); $wp_customize->add_setting( 'bizmark_show_services', array( 'default' => 'select', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bizmark_sanitize_yes_no_setting', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'bizmark_show_services', array( 'label' => __( 'Show services?', 'bizmark' ), 'settings' => 'bizmark_show_services', 'priority' => 10, 'section' => 'business_page_services', 'type' => 'select', 'choices' => $bizmarkYesNo, ) ) ); $wp_customize->add_setting( 'bizmark_products_one', array( 'default' => 'select', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bizmark_sanitize_post_selection', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'bizmark_products_one', array( 'label' => __( 'Product one', 'bizmark' ), 'description' => __( 'Select a post/page you want to show in welcome section', 'bizmark' ), 'settings' => 'bizmark_products_one', 'priority' => 20, 'section' => 'business_page_services', 'type' => 'select', 'choices' => $bizmarkPostsPagesArray, ) ) ); $wp_customize->add_setting( 'bizmark_products_two', array( 'default' => 'select', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bizmark_sanitize_post_selection', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'bizmark_products_two', array( 'label' => __( 'Product two', 'bizmark' ), 'description' => __( 'Select a post/page you want to show as product two', 'bizmark' ), 'settings' => 'bizmark_products_two', 'priority' => 30, 'section' => 'business_page_services', 'type' => 'select', 'choices' => $bizmarkPostsPagesArray, ) ) ); $wp_customize->add_setting( 'bizmark_products_three', array( 'default' => 'select', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bizmark_sanitize_post_selection', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'bizmark_products_three', array( 'label' => __( 'Product three', 'bizmark' ), 'description' => __( 'Select a post/page you want to show as product three', 'bizmark' ), 'settings' => 'bizmark_products_three', 'priority' => 40, 'section' => 'business_page_services', 'type' => 'select', 'choices' => $bizmarkPostsPagesArray, ) ) ); $wp_customize->add_section( 'business_page_quote', array( 'priority' => 30, 'capability' => 'edit_theme_options', 'title' => __('Quote Settings', 'bizmark'), 'active_callback' => 'bizmark_front_page_sections', 'panel' => 'business_page', ) ); $wp_customize->add_setting( 'bizmark_show_quote', array( 'default' => 'select', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bizmark_sanitize_yes_no_setting', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'bizmark_show_quote', array( 'label' => __( 'Show quote?', 'bizmark' ), 'settings' => 'bizmark_show_quote', 'priority' => 10, 'section' => 'business_page_quote', 'type' => 'select', 'choices' => $bizmarkYesNo, ) ) ); $wp_customize->add_setting( 'bizmark_quote_post', array( 'default' => 'select', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bizmark_sanitize_post_selection', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'bizmark_quote_post', array( 'label' => __( 'Quote', 'bizmark' ), 'description' => __( 'Select a post/page you want to show in quote section', 'bizmark' ), 'settings' => 'bizmark_quote_post', 'priority' => 20, 'section' => 'business_page_quote', 'type' => 'select', 'choices' => $bizmarkPostsPagesArray, ) ) ); $wp_customize->add_section( 'business_page_social', array( 'priority' => 30, 'capability' => 'edit_theme_options', 'title' => __('Social Settings', 'bizmark'), 'active_callback' => 'bizmark_front_page_sections', 'panel' => 'business_page', ) ); $wp_customize->add_setting( 'bizmark_show_social', array( 'default' => 'select', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bizmark_sanitize_yes_no_setting', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'bizmark_show_social', array( 'label' => __( 'Show social?', 'bizmark' ), 'settings' => 'bizmark_show_social', 'priority' => 10, 'section' => 'business_page_social', 'type' => 'select', 'choices' => $bizmarkYesNo, ) ) ); $wp_customize->add_setting( 'business_page_facebook', array( 'default' => '', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'business_page_facebook', array( 'type' => 'text', 'section' => 'business_page_social', // Add a default or your own section 'label' => __( 'Facebook', 'bizmark' ), 'description' => __( 'Enter your facebook url.', 'bizmark' ), ) ); $wp_customize->add_setting( 'business_page_flickr', array( 'default' => '', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'business_page_flickr', array( 'type' => 'text', 'section' => 'business_page_social', // Add a default or your own section 'label' => __( 'Flickr', 'bizmark' ), 'description' => __( 'Enter your flickr url.', 'bizmark' ), ) ); $wp_customize->add_setting( 'business_page_gplus', array( 'default' => '', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'business_page_gplus', array( 'type' => 'text', 'section' => 'business_page_social', // Add a default or your own section 'label' => __( 'Gplus', 'bizmark' ), 'description' => __( 'Enter your gplus url.', 'bizmark' ), ) ); $wp_customize->add_setting( 'business_page_linkedin', array( 'default' => '', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'business_page_linkedin', array( 'type' => 'text', 'section' => 'business_page_social', // Add a default or your own section 'label' => __( 'Linkedin', 'bizmark' ), 'description' => __( 'Enter your linkedin url.', 'bizmark' ), ) ); $wp_customize->add_setting( 'business_page_reddit', array( 'default' => '', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'business_page_reddit', array( 'type' => 'text', 'section' => 'business_page_social', // Add a default or your own section 'label' => __( 'Reddit', 'bizmark' ), 'description' => __( 'Enter your reddit url.', 'bizmark' ), ) ); $wp_customize->add_setting( 'business_page_stumble', array( 'default' => '', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'business_page_stumble', array( 'type' => 'text', 'section' => 'business_page_social', // Add a default or your own section 'label' => __( 'Stumble', 'bizmark' ), 'description' => __( 'Enter your stumble url.', 'bizmark' ), ) ); $wp_customize->add_setting( 'business_page_twitter', array( 'default' => '', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'business_page_twitter', array( 'type' => 'text', 'section' => 'business_page_social', // Add a default or your own section 'label' => __( 'Twitter', 'bizmark' ), 'description' => __( 'Enter your twitter url.', 'bizmark' ), ) ); } add_action( 'customize_register', 'bizmark_customize_register' ); /** * Render the site title for the selective refresh partial. * * @return void */ function bizmark_customize_partial_blogname() { bloginfo( 'name' ); } /** * Render the site tagline for the selective refresh partial. * * @return void */ function bizmark_customize_partial_blogdescription() { bloginfo( 'description' ); } /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function bizmark_customize_preview_js() { wp_enqueue_script( 'bizmark-customizer', get_template_directory_uri() . '/assets/js/customizer.js', array( 'customize-preview' ), '20151215', true ); } add_action( 'customize_preview_init', 'bizmark_customize_preview_js' ); require get_template_directory() . '/inc/bizmark-variables.php'; function bizmark_sanitize_yes_no_setting( $value ){ global $bizmarkYesNo; if ( ! array_key_exists( $value, $bizmarkYesNo ) ){ $value = 'select'; } return $value; } function bizmark_sanitize_post_selection( $value ){ global $bizmarkPostsPagesArray; if ( ! array_key_exists( $value, $bizmarkPostsPagesArray ) ){ $value = 'select'; } return $value; } function bizmark_front_page_sections(){ $value = false; if( 'page' == get_option( 'show_on_front' ) ){ $value = true; } return $value; } add_action( 'customize_register', 'bizmark_load_customize_classes', 0 ); function bizmark_load_customize_classes( $wp_customize ) { class bizmark_Customize_Control_Upgrade extends WP_Customize_Control { public $type = 'bizmark-upgrade'; public function enqueue() { } public function to_json() { parent::to_json(); $this->json['link'] = $this->get_link(); $this->json['value'] = $this->value(); $this->json['id'] = $this->id; //$this->json['default'] = $this->default; } public function render_content() {} public function content_template() { ?>

Upgrade

json['link'] = $this->get_link(); $this->json['value'] = $this->value(); $this->json['id'] = $this->id; //$this->json['default'] = $this->default; } public function render_content() {} public function content_template() { ?>
  1. Select 'A static page' for "your homepage displays" in 'select frontpage type' section of 'Home/Front Page settings' tab.
  2. Enter details for various section like header, welcome, services, quote, social sections.
register_control_type( 'bizmark_Customize_Control_Upgrade' ); $wp_customize->register_control_type( 'bizmark_Customize_Control_Guide' ); }