get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; $wp_customize->add_section( 'bw_color_options', array( 'title' => __( 'Color Options', 'black-white' ), 'priority' => 200, ) ); $wp_customize->add_setting( 'bw_color_scheme', array( 'default' => 'default', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'bw_sanitize_scheme_options', ) ); $wp_customize->add_control( 'bw_color_scheme', array( 'label' => __( 'Color Scheme', 'black-white' ), 'section' => 'bw_color_options', 'type' => 'select', 'choices' => array( 'default' => __( 'Default', 'black-white' ), 'red' => __( 'Red', 'black-white' ), 'green' => __( 'Green', 'black-white' ), 'blue' => __( 'Blue', 'black-white' ), 'yellow' => __( 'Yellow', 'black-white' ), 'rainbow' => __( 'Rainbow', 'black-white' ), 'brown' => __( 'Woody', 'black-white' ), 'pink' => __( 'Pinky', 'black-white' ), 'silver' => __( 'Silver', 'black-white' ), ), 'priority' => 35, ) ); $wp_customize->add_section( 'bw_social_link', array( 'title' => __( 'Social Media Icon Above Sidebar', 'black-white' ), 'priority' => 200, ) ); $wp_customize->add_setting( 'email_link', array( 'default' => '', 'sanitize_callback' => 'sanitize_email', ) ); $wp_customize->add_control( 'email_link', array( 'label' => __( 'Email Link', 'black-white' ), 'section' => 'bw_social_link', 'type' => 'text', 'priority' => 1, ) ); $wp_customize->add_setting( 'twitter_link', array( 'default' => '', 'sanitize_callback' => 'esc_url', ) ); $wp_customize->add_control( 'twitter_link', array( 'label' => __( 'Twitter Link', 'black-white' ), 'section' => 'bw_social_link', 'type' => 'text', 'priority' => 2, ) ); $wp_customize->add_setting( 'facebook_link', array( 'default' => '', 'sanitize_callback' => 'esc_url', ) ); $wp_customize->add_control( 'facebook_link', array( 'label' => __( 'Facebook Link', 'black-white' ), 'section' => 'bw_social_link', 'type' => 'text', 'priority' => 3, ) ); $wp_customize->add_setting( 'pinterest_link', array( 'default' => '', 'sanitize_callback' => 'esc_url', ) ); $wp_customize->add_control( 'pinterest_link', array( 'label' => __( 'Pinterest Link', 'black-white' ), 'section' => 'bw_social_link', 'type' => 'text', 'priority' => 4, ) ); $wp_customize->add_setting( 'google_plus_link', array( 'default' => '', 'sanitize_callback' => 'esc_url', ) ); $wp_customize->add_control( 'google_plus_link', array( 'label' => __( 'Google Plus Link', 'black-white' ), 'section' => 'bw_social_link', 'type' => 'text', 'priority' => 5, ) ); $wp_customize->add_setting( 'youtube_link', array( 'default' => '', 'sanitize_callback' => 'esc_url', ) ); $wp_customize->add_control( 'youtube_link', array( 'label' => __( 'YouTube Link', 'black-white' ), 'section' => 'bw_social_link', 'type' => 'text', 'priority' => 6, ) ); $wp_customize->add_setting( 'flickr_link', array( 'default' => '', 'sanitize_callback' => 'esc_url', ) ); $wp_customize->add_control( 'flickr_link', array( 'label' => __( 'Flickr Link', 'black-white' ), 'section' => 'bw_social_link', 'type' => 'text', 'priority' => 7, ) ); $wp_customize->add_setting( 'linkedin_link', array( 'default' => '', 'sanitize_callback' => 'esc_url', ) ); $wp_customize->add_control( 'linkedin_link', array( 'label' => __( 'LinkedIn Link', 'black-white' ), 'section' => 'bw_social_link', 'type' => 'text', 'priority' => 8, ) ); $wp_customize->add_setting( 'skype_link', array( 'default' => '', 'sanitize_callback' => 'esc_url', ) ); $wp_customize->add_control( 'skype_link', array( 'label' => __( 'Skype Link', 'black-white' ), 'section' => 'bw_social_link', 'type' => 'text', 'priority' => 9, ) ); $wp_customize->add_setting( 'tumblr_link', array( 'default' => '', 'sanitize_callback' => 'esc_url', ) ); $wp_customize->add_control( 'tumblr_link', array( 'label' => __( 'Tumblr Link', 'black-white' ), 'section' => 'bw_social_link', 'type' => 'text', 'priority' => 10, ) ); } add_action( 'customize_register', 'black_white_customize_register' ); function bw_sanitize_scheme_options( $option ) { if ( ! in_array( $option, array( 'default', 'red', 'green', 'blue', 'yellow', 'rainbow', 'brown', 'pink', 'silver' ) ) ) { $option = 'default'; } return $option; } /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function black_white_customize_preview_js() { wp_enqueue_script( 'black_white_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20130508', true ); } add_action( 'customize_preview_init', 'black_white_customize_preview_js' ); ?>