get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; // Signature $wp_customize->add_section( 'freebiescafe_signature_image', array( 'title' => __( 'Signature Image', 'cafe-blog' ), 'priority' => 1, ) ); $wp_customize->add_setting( 'freebiescafe_signature_image_setting', array( 'sanitize_callback' => 'esc_url_raw', 'transport' => 'refresh', ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'freebiescafe_signature_image_control', array( 'section' => 'freebiescafe_signature_image', 'settings' => 'freebiescafe_signature_image_setting', 'type' => 'image', ) ) ); // Social Media Icons $wp_customize->add_section( 'freebiescafe_social_media_section', array( 'title' => __( 'Social Media Icons', 'cafe-blog' ), 'priority' => 2, ) ); $wp_customize->add_setting( 'freebiescafe_social_media_twitter', array( 'default' => '', 'sanitize_callback' => 'esc_url_raw', 'transport' => 'refresh', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'freebiescafe_sm_twitter', array( 'label' => __( 'Twitter URL', 'cafe-blog' ), 'section' => 'freebiescafe_social_media_section', 'settings' => 'freebiescafe_social_media_twitter', 'type' => 'text', ) ) ); $wp_customize->add_setting( 'freebiescafe_social_media_facebook', array( 'default' => '', 'sanitize_callback' => 'esc_url_raw', 'transport' => 'refresh', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'freebiescafe_sm_facebook', array( 'label' => __( 'Facebook URL', 'cafe-blog' ), 'section' => 'freebiescafe_social_media_section', 'settings' => 'freebiescafe_social_media_facebook', 'type' => 'text', ) ) ); $wp_customize->add_setting( 'freebiescafe_social_media_instagram', array( 'default' => '', 'sanitize_callback' => 'esc_url_raw', 'transport' => 'refresh', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'freebiescafe_sm_instagram', array( 'label' => __( 'Instagram URL', 'cafe-blog' ), 'section' => 'freebiescafe_social_media_section', 'settings' => 'freebiescafe_social_media_instagram', 'type' => 'text', ) ) ); $wp_customize->add_setting( 'freebiescafe_social_media_pinterest', array( 'default' => '', 'sanitize_callback' => 'esc_url_raw', 'transport' => 'refresh', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'freebiescafe_sm_pinterest', array( 'label' => __( 'Pinterest URL', 'cafe-blog' ), 'section' => 'freebiescafe_social_media_section', 'settings' => 'freebiescafe_social_media_pinterest', 'type' => 'text', ) ) ); $wp_customize->add_setting( 'freebiescafe_social_media_snapchat', array( 'default' => '', 'sanitize_callback' => 'esc_url_raw', 'transport' => 'refresh', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'freebiescafe_sm_snapchat', array( 'label' => __( 'Snapchat URL', 'cafe-blog' ), 'section' => 'freebiescafe_social_media_section', 'settings' => 'freebiescafe_social_media_snapchat', 'type' => 'text', ) ) ); $wp_customize->add_setting( 'freebiescafe_social_media_youtube', array( 'default' => '', 'sanitize_callback' => 'esc_url_raw', 'transport' => 'refresh', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'freebiescafe_sm_youtube', array( 'label' => __( 'YouTube URL', 'cafe-blog' ), 'section' => 'freebiescafe_social_media_section', 'settings' => 'freebiescafe_social_media_youtube', 'type' => 'text', ) ) ); $wp_customize->add_setting( 'freebiescafe_social_media_googleplus', array( 'default' => '', 'sanitize_callback' => 'esc_url_raw', 'transport' => 'refresh', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'freebiescafe_sm_googleplus', array( 'label' => __( 'Google+ URL', 'cafe-blog' ), 'section' => 'freebiescafe_social_media_section', 'settings' => 'freebiescafe_social_media_googleplus', 'type' => 'text', ) ) ); // Related posts $taxonomies = get_taxonomies( array( 'public' => true, 'show_ui' => true ), 'names' ); $wp_customize->add_section( 'freebiescafe_related_posts', array( 'title' => __( 'Related Posts', 'cafe-blog' ), 'priority' => 3, ) ); $wp_customize->add_setting( 'freebiescafe_related_posts_setting', array( 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'refresh', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'freebiescafe_related_posts_control', array( 'label' => __( 'Get related posts by', 'cafe-blog' ), 'section' => 'freebiescafe_related_posts', 'settings' => 'freebiescafe_related_posts_setting', 'type' => 'select', 'choices' => $taxonomies ) ) ); } add_action( 'customize_register', 'freebiescafe_customize_register' ); /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function freebiescafe_customize_preview_js() { wp_enqueue_script( 'freebiescafe_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20130508', true ); } add_action( 'customize_preview_init', 'freebiescafe_customize_preview_js' );