get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; // Adds "Delivery Settings" section to the Theme Customization screen. $wp_customize->add_section( 'delivery_settings', array( 'title' => __( 'Delivery Settings', 'delivery' ), 'priority' => 150, ) ); // Logo setting. $wp_customize->add_setting( 'delivery_logo', array( 'sanitize_callback' => 'esc_url', 'capability' => 'edit_theme_options' ) ); // Logo control. $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'delivery_logo_control', array( 'label' => esc_html__( 'Upload Logo', 'delivery' ), 'section' => 'delivery_settings', 'settings' => 'delivery_logo' ) ) ); // Favicon setting. $wp_customize->add_setting( 'delivery_favicon', array( 'sanitize_callback' => 'esc_url', 'capability' => 'edit_theme_options' ) ); // Favicon control. $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'delivery_favicon_control', array( 'label' => esc_html__( 'Upload Favicon', 'delivery' ), 'section' => 'delivery_settings', 'settings' => 'delivery_favicon' ) ) ); // Featured Posts setting. $wp_customize->add_setting( 'delivery_featured_posts', array( 'default' => 'featured', 'sanitize_callback' => 'sanitize_text_field', 'capability' => 'edit_theme_options' ) ); // Featured Posts control. $wp_customize->add_control( 'delivery_featured_posts_control', array( 'label' => esc_html__( 'Tag slug for featured post', 'delivery' ), 'section' => 'delivery_settings', 'settings' => 'delivery_featured_posts' ) ); } /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. * * @since 1.0.0 */ function delivery_customize_preview_js() { wp_enqueue_script( 'delivery_customizer', trailingslashit( get_template_directory_uri() ) . 'assets/js/customizer.min.js', array( 'customize-preview' ), null, true ); }