add_section( 'blogable_stories_section', array( 'title' => esc_html__( 'Stories','blogable' ), 'description' => esc_html__( 'Stories Section options.', 'blogable' ), 'panel' => 'blogable_front_page_panel', ) ); // Stories content enable control and setting $wp_customize->add_setting( 'blogable_theme_options[stories_section_enable]', array( 'default' => $options['stories_section_enable'], 'sanitize_callback' => 'blogable_sanitize_switch_control', ) ); $wp_customize->add_control( new Blogable_Switch_Control( $wp_customize, 'blogable_theme_options[stories_section_enable]', array( 'label' => esc_html__( 'Stories Section Enable', 'blogable' ), 'section' => 'blogable_stories_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[stories_section_enable]', array( 'selector' => '#stories-section .tooltiptext', 'settings' => 'blogable_theme_options[stories_section_enable]', ) ); } // Stories section sub title control and setting $wp_customize->add_setting('blogable_theme_options[stories_sub_title]', array( 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'postMessage', 'default' => $options['stories_sub_title'], ) ); $wp_customize->add_control('blogable_theme_options[stories_sub_title]', array( 'label' => esc_html__('Section Sub Title', 'blogable'), 'section' => 'blogable_stories_section', 'type' => 'text', 'active_callback' => 'blogable_is_stories_section_enable', ) ); // Abort if selective refresh is not available. if ( isset( $wp_customize->selective_refresh ) ) { $wp_customize->selective_refresh->add_partial( 'blogable_theme_options[stories_sub_title]', array( 'selector' => '#stories-section .section-header p.section-subtitle', 'settings' => 'blogable_theme_options[stories_sub_title]', 'container_inclusive' => false, 'fallback_refresh' => true, 'render_callback' => 'blogable_stories_sub_title_partial', ) ); } // blog title setting and control $wp_customize->add_setting( 'blogable_theme_options[stories_title]', array( 'sanitize_callback' => 'sanitize_text_field', 'default' => $options['blog_title'], 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'blogable_theme_options[stories_title]', array( 'label' => esc_html__( 'Section Title', 'blogable' ), 'section' => 'blogable_stories_section', 'active_callback' => 'blogable_is_stories_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[stories_title]', array( 'selector' => '#stories-section .section-header h2.section-title', 'settings' => 'blogable_theme_options[stories_title]', 'container_inclusive' => false, 'fallback_refresh' => true, 'render_callback' => 'blogable_stories_title_partial', ) ); } // Add dropdown categories setting and control. $wp_customize->add_setting( 'blogable_theme_options[stories_category_exclude]', array( 'sanitize_callback' => 'blogable_sanitize_category_list', ) ) ; $wp_customize->add_control( new Blogable_Dropdown_Multiple_Chooser( $wp_customize, 'blogable_theme_options[stories_category_exclude]', array( 'label' => esc_html__( 'Select Excluding Categories', 'blogable' ), 'section' => 'blogable_stories_section', 'type' => 'dropdown_multiple_chooser', 'choices' => blogable_category_choices(), 'active_callback' => 'blogable_is_stories_section_enable' ) ) ); // Blog content setting $wp_customize->add_setting('blogable_theme_options[stories_read_more_btn_label]', array( 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'postMessage', 'default' => $options['stories_read_more_btn_label'] ) ); $wp_customize->add_control('blogable_theme_options[stories_read_more_btn_label]', array( 'section' => 'blogable_stories_section', 'label' => esc_html__( 'Read More Button Label', 'blogable' ), 'type' =>'text', 'active_callback' => 'blogable_is_stories_section_enable' ) ); // Abort if selective refresh is not available. if ( isset( $wp_customize->selective_refresh ) ) { $wp_customize->selective_refresh->add_partial( 'blogable_theme_options[stories_read_more_btn_label]', array( 'selector' => '#stories-section div.more-link a', 'settings' => 'blogable_theme_options[stories_read_more_btn_label]', 'fallback_refresh' => true, 'container_inclusive' => false, 'render_callback' => 'blogable_stories_read_more_btn_label_partial', ) ); }