add_section( 'section_home_popular', array( 'title' => __( 'Popular', 'blognetic' ), 'capability' => 'edit_theme_options', 'panel' => 'home_page_panel', ) ); $wp_customize->add_setting( 'theme_options[disable_popular_section]', array( 'default' => $default['disable_popular_section'], 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'iconic_blog_sanitize_switch_control', ) ); $wp_customize->add_control( new Blognetic_Switch_Control( $wp_customize, 'theme_options[disable_popular_section]', array( 'label' => __('Enable/Disable Popular Section', 'blognetic'), 'section' => 'section_home_popular', 'settings' => 'theme_options[disable_popular_section]', 'on_off_label' => blognetic_switch_options(), ) ) ); if ($homepage_design_layout !='home-three') { //Must Read Post Section title $wp_customize->add_setting('theme_options[popular_title]', array( 'default' => $default['popular_title'], 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('theme_options[popular_title]', array( 'label' => __('Section Title', 'blognetic'), 'section' => 'section_home_popular', 'settings' => 'theme_options[popular_title]', 'active_callback' => 'iconic_blog_popular_active', 'type' => 'text' ) ); } // Add arrow enable setting and control. $wp_customize->add_setting( 'theme_options[popular_content_align]', array( 'default' => $default['popular_content_align'], 'sanitize_callback' => 'iconic_blog_sanitize_select', ) ); $wp_customize->add_control( 'theme_options[popular_content_align]', array( 'label' => esc_html__( 'Choose Content Align', 'blognetic' ), 'section' => 'section_home_popular', 'type' => 'radio', 'active_callback' => 'iconic_blog_popular_active', 'choices' => array( 'content-right' => esc_html__( 'Right Side', 'blognetic' ), 'content-center' => esc_html__( 'Center Side', 'blognetic' ), 'content-left' => esc_html__( 'Left Side', 'blognetic' ), ) ) ); // Add category enable setting and control. $wp_customize->add_setting( 'theme_options[popular_category_enable]', array( 'default' => $default['popular_category_enable'], 'sanitize_callback' => 'iconic_blog_sanitize_checkbox', ) ); $wp_customize->add_control( 'theme_options[popular_category_enable]', array( 'label' => esc_html__( 'Enable Category', 'blognetic' ), 'section' => 'section_home_popular', 'type' => 'checkbox', 'active_callback' => 'iconic_blog_popular_active', ) ); // Add content enable setting and control. $wp_customize->add_setting( 'theme_options[popular_content_enable]', array( 'default' => $default['popular_content_enable'], 'sanitize_callback' => 'iconic_blog_sanitize_checkbox', ) ); $wp_customize->add_control( 'theme_options[popular_content_enable]', array( 'label' => esc_html__( 'Enable Content', 'blognetic' ), 'section' => 'section_home_popular', 'type' => 'checkbox', 'active_callback' => 'iconic_blog_popular_active', ) ); // Add posted on enable setting and control. $wp_customize->add_setting( 'theme_options[popular_posted_on_enable]', array( 'default' => $default['popular_posted_on_enable'], 'sanitize_callback' => 'iconic_blog_sanitize_checkbox', ) ); $wp_customize->add_control( 'theme_options[popular_posted_on_enable]', array( 'label' => esc_html__( 'Enable Date', 'blognetic' ), 'section' => 'section_home_popular', 'type' => 'checkbox', 'active_callback' => 'iconic_blog_popular_active', ) ); // Add posted on enable setting and control. $wp_customize->add_setting( 'theme_options[popular_author_enable]', array( 'default' => $default['popular_author_enable'], 'sanitize_callback' => 'iconic_blog_sanitize_checkbox', ) ); $wp_customize->add_control( 'theme_options[popular_author_enable]', array( 'label' => esc_html__( 'Enable Author', 'blognetic' ), 'section' => 'section_home_popular', 'type' => 'checkbox', 'active_callback' => 'iconic_blog_popular_active', ) ); // Number of items $wp_customize->add_setting('theme_options[popular_excerpt_length]', array( 'default' => $default['popular_excerpt_length'], 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'iconic_blog_sanitize_number_range' ) ); $wp_customize->add_control('theme_options[popular_excerpt_length]', array( 'label' => __('Excerpt Length', 'blognetic'), 'description' => __('Save & Refresh the customizer to see its effect. Maximum is 1000.', 'blognetic'), 'section' => 'section_home_popular', 'settings' => 'theme_options[popular_excerpt_length]', 'type' => 'number', 'active_callback' => 'iconic_blog_popular_active', 'input_attrs' => array( 'min' => 0, 'max' => 1000, 'step' => 1, ), ) ); $number_of_popular_items = blognetic_get_option( 'number_of_popular_items' ); for( $i=1; $i<=$number_of_popular_items; $i++ ){ // $wp_customize->add_setting('theme_options[popular_post_'.$i.']', array( 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'iconic_blog_dropdown_pages' ) ); $wp_customize->add_control('theme_options[popular_post_'.$i.']', array( 'label' => sprintf( __('Select Post #%1$s', 'blognetic'), $i), 'section' => 'section_home_popular', 'settings' => 'theme_options[popular_post_'.$i.']', 'type' => 'select', 'choices' => blognetic_post_choices(), 'active_callback' => 'iconic_blog_popular_active', ) ); }