get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; } add_action( 'customize_register', 'akihabara_customize_register' ); /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function akihabara_customize_preview_js() { wp_enqueue_script( 'akihabara_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20130508', true ); } add_action( 'customize_preview_init', 'akihabara_customize_preview_js' ); /** * Add Social Media Section */ function akihabara_social_customizer($wp_customize){ $wp_customize->add_section( 'social-media' , array( 'title' => __( 'Social Media', 'akihabara' ), 'priority' => 30, 'description' => __( 'Leave a field blank in order to don\'t display it.', 'akihabara' ) ) ); // Add Twitter Setting $wp_customize->add_setting( 'twitter' , array( 'default' => '', 'sanitize_callback' => 'esc_url_raw')); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'twitter', array( 'label' => __( 'Twitter', 'akihabara' ), 'section' => 'social-media', 'settings' => 'twitter', ) ) ); // Add Facebook Setting $wp_customize->add_setting( 'facebook' , array( 'default' => '', 'sanitize_callback' => 'esc_url_raw')); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'facebook', array( 'label' => __( 'Facebook', 'akihabara' ), 'section' => 'social-media', 'settings' => 'facebook', ) ) ); // Add googleplus Setting $wp_customize->add_setting( 'googleplus' , array( 'default' => '', 'sanitize_callback' => 'esc_url_raw')); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'googleplus', array( 'label' => __( 'Google+', 'akihabara' ), 'section' => 'social-media', 'settings' => 'googleplus', ) ) ); // Add youtube Setting $wp_customize->add_setting( 'youtube' , array( 'default' => '', 'sanitize_callback' => 'esc_url_raw')); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'youtube', array( 'label' => __( 'Youtube', 'akihabara' ), 'section' => 'social-media', 'settings' => 'youtube', ) ) ); // Add Instagram Setting $wp_customize->add_setting( 'instagram' , array( 'default' => '', 'sanitize_callback' => 'esc_url_raw')); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'instagram', array( 'label' => __( 'Instagram', 'akihabara' ), 'section' => 'social-media', 'settings' => 'instagram', ) ) ); } add_action( 'customize_register', 'akihabara_social_customizer' );