add_section( 'blogable_promotion_section', array( 'title' => esc_html__( 'Promotion','blogable' ), 'description' => esc_html__( 'Promotion Section options.', 'blogable' ), 'panel' => 'blogable_front_page_panel', ) ); // Promotion content enable control and setting $wp_customize->add_setting( 'blogable_theme_options[promotion_section_enable]', array( 'default' => $options['promotion_section_enable'], 'sanitize_callback' => 'blogable_sanitize_switch_control', ) ); $wp_customize->add_control( new Blogable_Switch_Control( $wp_customize, 'blogable_theme_options[promotion_section_enable]', array( 'label' => esc_html__( 'Promotion Section Enable', 'blogable' ), 'section' => 'blogable_promotion_section', 'on_off_label' => blogable_switch_options(), ) ) ); // Abort if selective refresh is not available. if ( isset( $wp_customize->selective_refresh ) ) { $wp_customize->selective_refresh->add_partial( 'blogable_theme_options[promotion_section_enable]', array( 'selector' => '#promotion-section .tooltiptext', 'settings' => 'blogable_theme_options[promotion_section_enable]', ) ); } $wp_customize->add_setting( 'blogable_theme_options[promotion_content_page]', array( 'sanitize_callback' => 'blogable_sanitize_page', ) ); $wp_customize->add_control( new Blogable_Dropdown_Chooser( $wp_customize, 'blogable_theme_options[promotion_content_page]', array( 'label' => esc_html__( 'Select Page', 'blogable' ), 'section' => 'blogable_promotion_section', 'choices' => blogable_page_choices(), 'active_callback' => 'blogable_is_promotion_section_enable', ) ) ); // Promotion read more setting and control $wp_customize->add_setting( 'blogable_theme_options[promotion_read_more]', array( 'default' => $options['promotion_read_more'], 'sanitize_callback' => 'sanitize_text_field', 'transport' =>'postMessage', ) ); $wp_customize->add_control( 'blogable_theme_options[promotion_read_more]', array( 'label' => esc_html__( 'Read More Text', 'blogable' ), 'section' => 'blogable_promotion_section', 'active_callback' => 'blogable_is_promotion_section_enable', 'type' => 'text', ) ); // Abort if selective refresh is not available. if ( isset( $wp_customize->selective_refresh ) ) { $wp_customize->selective_refresh->add_partial( 'blogable_theme_options[promotion_read_more]', array( 'selector' => '#promotion-section .wrapper .read-more a.btn', 'settings' => 'blogable_theme_options[promotion_read_more]', 'container_inclusive' => false, 'fallback_refresh' => true, 'render_callback' => 'blogable_promotion_read_more_partial', ) ); }