get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; if ( isset( $wp_customize->selective_refresh ) ) { $wp_customize->selective_refresh->add_partial( 'blogname', array( 'selector' => '.site-title a', 'render_callback' => 'breeze_customize_partial_blogname', ) ); $wp_customize->selective_refresh->add_partial( 'blogdescription', array( 'selector' => '.site-description', 'render_callback' => 'breeze_customize_partial_blogdescription', ) ); } //home banner image $wp_customize->add_section( 'breeze_section_home_banner', array( 'title' => esc_html__( 'Home Banner', 'breeze' ), 'description' => esc_html__( 'Select background image for the Home banner', 'breeze' ), 'active_callback' => 'is_front_page', 'priority' => 50 )); $wp_customize->add_setting( 'breeze_home_banner_image', array( 'default' => get_stylesheet_directory_uri() . '/img/wallpaper1.jpg', 'sanitize_callback' => 'esc_url_raw', 'transport' => 'refresh', )); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'breeze_home_banner_image', array( 'settings' => 'breeze_home_banner_image', 'section' => 'breeze_section_home_banner', 'label' => esc_html__( 'Home Top Background Image', 'breeze' ), 'description' => esc_html__( 'Select the image to be used for Home Top Background.', 'breeze' ) ) )); //home banner title $wp_customize->add_setting( 'home_banner_title', array( 'default' => esc_html__( 'Default Text For Banner Section', 'breeze' ), 'sanitize_callback' => 'sanitize_text', 'transport' => 'refresh', )); $wp_customize->add_control(new WP_Customize_Control( $wp_customize,'home_banner_title', array( 'label' => esc_html__('Home Banner Title', 'breeze'), 'description' => esc_html__('Give your title here', 'breeze'), 'section' => 'breeze_section_home_banner', 'settings' => 'home_banner_title', 'type' => 'textarea', ))); //home banner description $wp_customize->add_setting('banner_description', array( 'default' => esc_html__('Default Description Text in Banner Section','breeze'), 'sanitize_callback' => 'wp_kses_post', 'transport' => 'refresh', )); $wp_customize->add_control(new WP_Customize_Control( $wp_customize, 'banner_description', array( 'label' => esc_html__('Home Banner Description', 'breeze'), 'description' => esc_html__('Give your description here', 'breeze'), 'section' => 'breeze_section_home_banner', 'settings' => 'banner_description', 'type' => 'textarea', ))); //home banner button 1 $wp_customize->add_setting('banner_button1', array( 'default' => esc_html__('Default Button1','breeze'), 'sanitize_callback' => 'wp_kses_post', 'transport' => 'refresh', )); $wp_customize->add_control(new WP_Customize_Control( $wp_customize, 'banner_button1', array( 'label' => esc_html__('Home Banner button 1', 'breeze'), 'description' => esc_html__('Add your Button here', 'breeze'), 'section' => 'breeze_section_home_banner', 'settings' => 'banner_button1', ))); //button 1 link $wp_customize->add_setting( 'button1_url', array( 'type' => 'theme_mod', 'transport' => 'refresh', 'sanitize_callback' => 'esc_url', ) ); $wp_customize->add_control(new WP_Customize_Control( $wp_customize, 'button1_url', array( 'type' => 'url', 'section' => 'breeze_section_home_banner', 'description' => esc_html__('Give the url path', 'breeze'), ))); //home banner button 2 $wp_customize->add_setting('banner_button2', array( 'default' => esc_html__('Default Button2','breeze'), 'sanitize_callback' => 'wp_kses_post', 'transport' => 'refresh', )); $wp_customize->add_control(new WP_Customize_Control( $wp_customize, 'banner_button2', array( 'label' => esc_html__('Home Banner button 2', 'breeze'), 'description' => esc_html__('Add your Button here', 'breeze'), 'section' => 'breeze_section_home_banner', 'settings' => 'banner_button2', ))); //button 2 link $wp_customize->add_setting( 'button2_url', array( 'type' => 'theme_mod', 'transport' => 'refresh', 'sanitize_callback' => 'esc_url', ) ); $wp_customize->add_control(new WP_Customize_Control( $wp_customize, 'button2_url', array( 'type' => 'url', 'section' => 'breeze_section_home_banner', 'description' => esc_html__('Give the url path', 'breeze'), ))); //color palette // main color $wp_customize->add_setting( 'main_color', array( 'default' => '#000', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'refresh', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'main_color', array( 'label' => 'Main Color', 'description' => esc_html__('site title, h1, h2, h4. h6, widget headings, nav links, footer headings', 'breeze'), 'section' => 'breeze_section_home_banner', 'settings' => 'main_color', ))); // secondary color $wp_customize->add_setting( 'secondary_color', array( 'default' => '#666', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'refresh', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'secondary_color', array( 'label' => 'Secondary Color', 'description' => esc_html__('site description, sidebar headings, h3, h5, nav links on hover', 'breeze'), 'section' => 'breeze_section_home_banner', 'settings' => 'secondary_color', ))); // link color $wp_customize->add_setting( 'link_color', array( 'default' => '#666', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'refresh', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'link_color', array( 'label' => 'Link Color', 'section' => 'breeze_section_home_banner', 'settings' => 'link_color', ))); // link background color $wp_customize->add_setting( 'link_bgcolor', array( 'default' => '#02b875', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'refresh', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'link_bgcolor', array( 'label' => 'Link Background Color', 'section' => 'breeze_section_home_banner', 'settings' => 'link_bgcolor', ))); // link color ( hover) $wp_customize->add_setting( 'link_hover_bg', array( 'default' => '#029f65', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'refresh', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'link_hover_bg', array( 'label' => 'Link Hover Background', 'section' => 'breeze_section_home_banner', 'settings' => 'link_hover_bg', ))); // link border color $wp_customize->add_setting( 'link_border_color', array( 'default' => '#fff', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'refresh', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'link_border_color', array( 'label' => 'Link Border Color', 'section' => 'breeze_section_home_banner', 'settings' => 'link_border_color', ))); // Sanitize text function sanitize_text( $text ) { return sanitize_text_field( $text ); } } add_action( 'customize_register', 'breeze_customize_register' ); /** * Render the site title for the selective refresh partial. * * @return void */ function breeze_customize_partial_blogname() { bloginfo( 'name' ); } /** * Render the site tagline for the selective refresh partial. * * @return void */ function breeze_customize_partial_blogdescription() { bloginfo( 'description' ); } /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function breeze_customize_preview_js() { wp_enqueue_script( 'breeze-customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20151215', true ); } add_action( 'customize_preview_init', 'breeze_customize_preview_js' );