get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; // header option $wp_customize->add_section("home_page_set", array( "title" => __("Header Section", "business-booster"), "priority" => 29, )); // for call us label $wp_customize->add_setting("business_booster_call_label", array( "default" => '', "transport" => "refresh", 'sanitize_callback' => 'business_booster_text_sanitize_row' )); $wp_customize->add_control(new WP_Customize_Control( $wp_customize, "business_booster_call_label", array( "label" => __("Call Us Label", "business-booster"), "section" => "home_page_set", "settings" => "business_booster_call_label", ) )); // for call us number $wp_customize->add_setting("business_booster_call_num", array( "default" => '', "transport" => "refresh", 'sanitize_callback' => 'business_booster_text_sanitize_row' )); $wp_customize->add_control(new WP_Customize_Control( $wp_customize, "business_booster_call_num", array( "label" => __("Call Us Number", "business-booster"), "section" => "home_page_set", "settings" => "business_booster_call_num", ) )); // for email label $wp_customize->add_setting("business_booster_email_label", array( "default" => '', "transport" => "refresh", 'sanitize_callback' => 'business_booster_text_sanitize_row' )); $wp_customize->add_control(new WP_Customize_Control( $wp_customize, "business_booster_email_label", array( "label" => __("Email Label", "business-booster"), "section" => "home_page_set", "settings" => "business_booster_email_label", ) )); // for email id $wp_customize->add_setting("business_booster_email_id", array( "default" => '', "transport" => "refresh", 'sanitize_callback' => 'business_booster_text_sanitize_row' )); $wp_customize->add_control(new WP_Customize_Control( $wp_customize, "business_booster_email_id", array( "label" => __("Email Id:", "business-booster"), "section" => "home_page_set", "settings" => "business_booster_email_id", ) )); // for Follow us text $wp_customize->add_setting("business_booster_follow_us_text", array( "default" => '', "transport" => "refresh", 'sanitize_callback' => 'business_booster_text_sanitize_row' )); $wp_customize->add_control(new WP_Customize_Control( $wp_customize, "business_booster_follow_us_text", array( "label" => __("Follow Us Text", "business-booster"), "section" => "home_page_set", "settings" => "business_booster_follow_us_text", ) )); // for facebook icons on off option $wp_customize->add_setting("social_fb_sec_on_off", array( "default" => 'off', "transport" => "refresh", 'sanitize_callback' => 'business_booster_radio_sanitize_row', )); $wp_customize->add_control(new WP_Customize_Control( $wp_customize, "social_fb_sec_on_off", array( 'type' => 'radio', 'label' => __("Facebook Icon On/Off", "business-booster"), 'section' => 'home_page_set', 'choices' => array( 'on' => 'On', 'off' => 'Off', ), ) )); // for social site link options // for facebook link $wp_customize->add_setting("social_fb_btn_lnk", array( "default" => '', "transport" => "refresh", 'sanitize_callback' => 'esc_url_raw', )); $wp_customize->add_control(new WP_Customize_Control( $wp_customize, "social_fb_btn_lnk", array( "label" => __("Facebook Button Link", "business-booster"), "section" => "home_page_set", "settings" => "social_fb_btn_lnk", "type" => "url", ) )); // for twitter icons on off option $wp_customize->add_setting("social_twitter_sec_on_off", array( "default" => 'off', "transport" => "refresh", 'sanitize_callback' => 'business_booster_radio_sanitize_row', )); $wp_customize->add_control(new WP_Customize_Control( $wp_customize, "social_twitter_sec_on_off", array( 'type' => 'radio', 'label' => __("Twitter Icon On/Off", "business-booster"), 'section' => 'home_page_set', 'choices' => array( 'on' => 'On', 'off' => 'Off', ), ) )); // for twitter link $wp_customize->add_setting("social_twitter_btn_lnk", array( "default" => '', "transport" => "refresh", 'sanitize_callback' => 'esc_url_raw', )); $wp_customize->add_control(new WP_Customize_Control( $wp_customize, "social_twitter_btn_lnk", array( "label" => __("Twitter Button Link", "business-booster"), "section" => "home_page_set", "settings" => "social_twitter_btn_lnk", "type" => "url", ) )); // for linkedin icons on off option $wp_customize->add_setting("social_linkedin_sec_on_off", array( "default" => 'off', "transport" => "refresh", 'sanitize_callback' => 'business_booster_radio_sanitize_row', )); $wp_customize->add_control(new WP_Customize_Control( $wp_customize, "social_linkedin_sec_on_off", array( 'type' => 'radio', 'label' => __("Linkedin Icon On/Off", "business-booster"), 'section' => 'home_page_set', 'choices' => array( 'on' => 'On', 'off' => 'Off', ), ) )); // for linkedin link $wp_customize->add_setting("social_linkedin_btn_lnk", array( "default" => '', "transport" => "refresh", 'sanitize_callback' => 'esc_url_raw', )); $wp_customize->add_control(new WP_Customize_Control( $wp_customize, "social_linkedin_btn_lnk", array( "label" => __("Linkedin Button Link", "business-booster"), "section" => "home_page_set", "settings" => "social_linkedin_btn_lnk", "type" => "url", ) )); // for google icons on off option $wp_customize->add_setting("social_google_sec_on_off", array( "default" => 'off', "transport" => "refresh", 'sanitize_callback' => 'business_booster_radio_sanitize_row', )); $wp_customize->add_control(new WP_Customize_Control( $wp_customize, "social_google_sec_on_off", array( 'type' => 'radio', 'label' => __("Google Plus Icon On/Off", "business-booster"), 'section' => 'home_page_set', 'choices' => array( 'on' => 'On', 'off' => 'Off', ), ) )); // for google link $wp_customize->add_setting("social_google_btn_lnk", array( "default" => '', "transport" => "refresh", 'sanitize_callback' => 'esc_url_raw', )); $wp_customize->add_control(new WP_Customize_Control( $wp_customize, "social_google_btn_lnk", array( "label" => __("Google Plus Button Link", "business-booster"), "section" => "home_page_set", "settings" => "social_google_btn_lnk", "type" => "url", ) )); // for rss icons on off option $wp_customize->add_setting("social_rss_sec_on_off", array( "default" => 'off', "transport" => "refresh", 'sanitize_callback' => 'business_booster_radio_sanitize_row', )); $wp_customize->add_control(new WP_Customize_Control( $wp_customize, "social_rss_sec_on_off", array( 'type' => 'radio', 'label' => __("RSS Icon On/Off", "business-booster"), 'section' => 'home_page_set', 'choices' => array( 'on' => 'On', 'off' => 'Off', ), ) )); // for rss feed link $wp_customize->add_setting("social_rssfeed_btn_lnk", array( "default" => '', "transport" => "refresh", 'sanitize_callback' => 'esc_url_raw', )); $wp_customize->add_control(new WP_Customize_Control( $wp_customize, "social_rssfeed_btn_lnk", array( "label" => __("RSS Feed Button Link", "business-booster"), "section" => "home_page_set", "settings" => "social_rssfeed_btn_lnk", "type" => "url", ) )); //Footer text $wp_customize->add_section("footer_sec", array( "title" => __("Footer Text", "business-booster"), "priority" => 35, )); // for copyright text $wp_customize->add_setting("business_booster_copyright_text", array( "default" => '', "transport" => "refresh", 'sanitize_callback' => 'business_booster_text_sanitize_row' )); $wp_customize->add_control(new WP_Customize_Control( $wp_customize, "business_booster_copyright_text", array( "label" => __("Footer Text", "business-booster"), "section" => "footer_sec", "settings" => "business_booster_copyright_text", ) )); } add_action( 'customize_register', 'business_booster_customize_register' ); // sanitize_callback function function business_booster_text_sanitize_row( $input ) { return wp_kses_post( force_balance_tags( $input ) ); } function business_booster_radio_sanitize_row($input) { $valid_keys = array( 'on' => 'On', 'off' => 'Off', ); if ( array_key_exists( $input, $valid_keys ) ) { return $input; } else { return ''; } } /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function business_booster_customize_preview_js() { wp_enqueue_script( 'business_booster_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20151215', true ); } add_action( 'customize_preview_init', 'business_booster_customize_preview_js' );