add_section('popular_posts_section', array( 'title' => __('Popular Posts Section', 'adaptable-blog'), 'panel' => 'theme_option_panel' )); // Enable / Disable $wp_customize->add_setting('popular_posts', array( 'default' => true, 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'elastic_blog_sanitize_checkbox', 'transport' => 'refresh', ) ); $wp_customize->add_control('popular_posts', array( 'label' => __('Enable Popular Posts', 'adaptable-blog'), 'section' => 'popular_posts_section', 'settings' => 'popular_posts', 'type' => 'checkbox', ) ); // Section Title $wp_customize->add_setting('popular_posts_section_title', array( 'default' => esc_html__('Popular News', 'adaptable-blog'), 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('popular_posts_section_title', array( 'label' => __('Section Title', 'adaptable-blog'), 'section' => 'popular_posts_section', 'settings' => 'popular_posts_section_title', 'type' => 'text' ) ); // Number of items $wp_customize->add_setting('number_of_popular_posts_items', array( 'default' => 3, 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'elastic_blog_sanitize_number_range' ) ); $wp_customize->add_control('number_of_popular_posts_items', array( 'label' => __('Number of Items (Max: 15)', 'adaptable-blog'), 'section' => 'popular_posts_section', 'settings' => 'number_of_popular_posts_items', 'type' => 'number', 'input_attrs' => array( 'min' => 1, 'max' => 15, 'step' => 1, ), ) ); // Category Dropdown $wp_customize->add_setting('popular_posts_category', array( 'default' => '', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'elastic_blog_sanitize_select', 'transport' => 'refresh', ) ); $wp_customize->add_control('popular_posts_category', array( 'label' => __('Select Categories', 'adaptable-blog'), 'section' => 'popular_posts_section', 'settings' => 'popular_posts_category', 'type' => 'select', 'choices' => adaptable_blog_get_post_categories(), ) );