add_section( 'blooming_blog_banner_section', array( 'title' => esc_html__( 'Banner Section', 'blooming-blog' ), 'panel' => 'blooming_blog_frontpage_panel', ) ); // Banner section enable settings. $wp_customize->add_setting( 'blooming_blog_banner_section_enable', array( 'default' => false, 'sanitize_callback' => 'blooming_blog_sanitize_checkbox', ) ); $wp_customize->add_control( new Blooming_Blog_Toggle_Checkbox_Custom_control( $wp_customize, 'blooming_blog_banner_section_enable', array( 'label' => esc_html__( 'Enable Banner Section', 'blooming-blog' ), 'description' => wp_kses_post( '*Note: You can set the header image through the Header Image setting. To set the header image, go to Customizer > Header Image. There you can set the header image.', 'blooming-blog' ), 'type' => 'checkbox', 'section' => 'blooming_blog_banner_section', 'settings' => 'blooming_blog_banner_section_enable', ) ) ); // Banner title settings. $wp_customize->add_setting( 'blooming_blog_banner_title', array( 'default' => __( 'Welcome to my world', 'blooming-blog' ), 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'blooming_blog_banner_title', array( 'label' => esc_html__( 'Title', 'blooming-blog' ), 'section' => 'blooming_blog_banner_section', 'active_callback' => 'blooming_blog_if_banner_enabled', 'settings' => 'blooming_blog_banner_title', ) ); $wp_customize->selective_refresh->add_partial( 'blooming_blog_banner_title', array( 'selector' => '.banner-section h2.banner-section-title', 'settings' => 'blooming_blog_banner_title', 'container_inclusive' => false, 'fallback_refresh' => true, 'render_callback' => 'blooming_blog_banner_partial_title', ) ); // Banner subtitle settings. $wp_customize->add_setting( 'blooming_blog_banner_description', array( 'default' => __( 'Dive in, explore, and lets connect over the things that inspire us most!', 'blooming-blog' ), 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'blooming_blog_banner_description', array( 'label' => esc_html__( 'Banner Description', 'blooming-blog' ), 'section' => 'blooming_blog_banner_section', 'active_callback' => 'blooming_blog_if_banner_enabled', 'settings' => 'blooming_blog_banner_description', 'type' => 'textarea', ) ); /*========================Active Callback==============================*/ function blooming_blog_if_banner_enabled( $control ) { return $control->manager->get_setting( 'blooming_blog_banner_section_enable' )->value(); } /*========================Partial Refresh==============================*/ if ( ! function_exists( 'blooming_blog_banner_partial_title' ) ) : // Title. function blooming_blog_banner_partial_title() { return esc_html( get_theme_mod( 'blooming_blog_banner_title' ) ); } endif;