get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; //favicon $wp_customize -> add_section('framework_favicon_section',array( 'title' => __('Favicon Image','framework'), 'priority' => 25, 'description' => 'Upload favicon here 16x16 (no .ico)', )); $wp_customize -> add_setting('framework_favicon'); $wp_customize -> add_control(new WP_Customize_Image_Control($wp_customize,'framework_favicon',array( 'label' => __('Favicon','framework'), 'section' => 'framework_favicon_section', 'settings' => 'framework_favicon', ))); //Social top-header share social buttons only $wp_customize->add_section('framework_social_section',array( 'title'=>'Share Social Buttons', 'description' =>'Here goes social buttons. Only for share', 'priority'=>30 )); //Header Section $wp_customize->add_setting('header_social',array( 'sanitize_callback'=>'framework_sanitize_checkbox' )); $wp_customize->add_control('header_social',array( 'type'=>'checkbox', 'label'=>'Hide header social section', 'section'=>'framework_social_section', 'priority'=> 1 )); //Facebook $wp_customize->add_setting('framework_fb',array( 'sanitize_callback'=>'framework_sanitize_text' )); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'framework_fb',array( 'label'=>'Facebook URL: ', 'section'=>'framework_social_section', 'settings'=>'framework_fb', 'priority'=> 2 ))); //Twitter $wp_customize->add_setting('framework_tweet',array( 'sanitize_callback'=>'framework_sanitize_text' )); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'framework_tweet',array( 'label'=>'Twitter URL: ', 'section'=>'framework_social_section', 'settings'=>'framework_tweet', 'priority'=> 3 ))); //Googleplus $wp_customize->add_setting('framework_google',array( 'sanitize_callback'=>'framework_sanitize_text' )); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'framework_google',array( 'label'=>'Google-Plus URL: ', 'section'=>'framework_social_section', 'settings'=>'framework_google', 'priority'=> 4 ))); //Linkedin $wp_customize->add_setting('framework_linkedin',array( 'sanitize_callback'=>'framework_sanitize_text' )); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'framework_linkedin',array( 'label'=>'Linkedin URL: ', 'section'=>'framework_social_section', 'settings'=>'framework_linkedin', 'priority'=> 5 ))); //Instagram $wp_customize->add_setting('framework_instagram',array( 'sanitize_callback'=>'framework_sanitize_text' )); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'framework_instagram',array( 'label'=>'Instagram URL: ', 'section'=>'framework_social_section', 'settings'=>'framework_instagram', 'priority'=> 6 ))); //Flickr $wp_customize->add_setting('framework_flickr',array( 'sanitize_callback'=>'framework_sanitize_text' )); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'framework_flickr',array( 'label'=>'Flickr URL: ', 'section'=>'framework_social_section', 'settings'=>'framework_flickr', 'priority'=> 7 ))); //Pinterest $wp_customize->add_setting('framework_pinte',array( 'sanitize_callback'=>'framework_sanitize_text' )); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'framework_pinte',array( 'label'=>'Pinterest URL: ', 'section'=>'framework_social_section', 'settings'=>'framework_pinte', 'priority'=> 8 ))); //Tumblr $wp_customize->add_setting('framework_tumblr',array( 'sanitize_callback'=>'framework_sanitize_text' )); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'framework_tumblr',array( 'label'=>'Tumblr URL: ', 'section'=>'framework_social_section', 'settings'=>'framework_tumblr', 'priority'=> 9 ))); //Dribbble $wp_customize->add_setting('framework_dribbble',array( 'sanitize_callback'=>'framework_sanitize_text' )); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'framework_dribbble',array( 'label'=>'Dribbble URL: ', 'section'=>'framework_social_section', 'settings'=>'framework_dribbble', 'priority'=> 10 ))); //Rss $wp_customize->add_setting('framework_rss',array( 'sanitize_callback'=>'framework_sanitize_text' )); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'framework_rss',array( 'label'=>'RSS URL: ', 'section'=>'framework_social_section', 'settings'=>'framework_rss', 'priority'=> 11 ))); //Youtube $wp_customize->add_setting('framework_youtube',array( 'sanitize_callback'=>'framework_sanitize_text' )); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'framework_youtube',array( 'label'=>'Youtube URL: ', 'section'=>'framework_social_section', 'settings'=>'framework_youtube', 'priority'=> 12 ))); //Vimeo $wp_customize->add_setting('framework_vimeo',array( 'sanitize_callback'=>'framework_sanitize_text' )); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'framework_vimeo',array( 'label'=>'Vimeo URL: ', 'section'=>'framework_social_section', 'settings'=>'framework_vimeo', 'priority'=> 13 ))); } add_action( 'customize_register', 'framework_customize_register' ); /* Sanitize section */ //text sanitize function framework_sanitize_text($input){ return wp_kses_post(force_balance_tags($input)); } //checkbox sanitize function framework_sanitize_checkbox($input){ if($input == 1){ return 1; }else { return ''; } } //html sanitize function framework_sanitize_html($string){ $allowed_html = array( 'div' => array( 'id' => array() ), 'script' => array( 'src'=>array(), 'type'=>array() ) ); return wp_kses($string, $allowed_html); } /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function framework_customize_preview_js() { wp_enqueue_script( 'framework_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20130508', true ); } add_action( 'customize_preview_init', 'framework_customize_preview_js' );