add_section( 'section_home_mustread', array( 'title' => __( 'Must Read Posts', 'akisa' ), 'priority' => 45, 'capability' => 'edit_theme_options', 'panel' => 'home_page_panel', ) ); $wp_customize->add_setting( 'theme_options[disable_mustread_section]', array( 'default' => $default['disable_mustread_section'], 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'akisa_sanitize_switch_control', ) ); $wp_customize->add_control( new Akisa_Switch_Control( $wp_customize, 'theme_options[disable_mustread_section]', array( 'label' => __('Enable/Disable Must Read Section', 'akisa'), 'section' => 'section_home_mustread', 'settings' => 'theme_options[disable_mustread_section]', 'on_off_label' => akisa_switch_options(), ) ) ); // Add arrow enable setting and control. $wp_customize->add_setting( 'theme_options[mustread_content_align]', array( 'default' => $default['mustread_content_align'], 'sanitize_callback' => 'akisa_sanitize_select', ) ); $wp_customize->add_control( 'theme_options[mustread_content_align]', array( 'label' => esc_html__( 'Choose Content Align', 'akisa' ), 'section' => 'section_home_mustread', 'type' => 'radio', 'active_callback' => 'akisa_mustread_active', 'choices' => array( 'content-right' => esc_html__( 'Right Side', 'akisa' ), 'content-left' => esc_html__( 'Left Side', 'akisa' ), ) ) ); //Must Read Section title $wp_customize->add_setting('theme_options[mustread_title]', array( 'default' => $default['mustread_title'], 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control('theme_options[mustread_title]', array( 'label' => __('Section Title', 'akisa'), 'section' => 'section_home_mustread', 'settings' => 'theme_options[mustread_title]', 'active_callback' => 'akisa_mustread_active', 'type' => 'text' ) ); // Add posted on enable setting and control. $wp_customize->add_setting( 'theme_options[mustread_posted_on_enable]', array( 'default' => $default['mustread_posted_on_enable'], 'sanitize_callback' => 'akisa_sanitize_checkbox', ) ); $wp_customize->add_control( 'theme_options[mustread_posted_on_enable]', array( 'label' => esc_html__( 'Enable Date', 'akisa' ), 'section' => 'section_home_mustread', 'type' => 'checkbox', 'active_callback' => 'akisa_mustread_active', ) ); // Add posted on enable setting and control. $wp_customize->add_setting( 'theme_options[mustread_author_enable]', array( 'default' => $default['mustread_author_enable'], 'sanitize_callback' => 'akisa_sanitize_checkbox', ) ); $wp_customize->add_control( 'theme_options[mustread_author_enable]', array( 'label' => esc_html__( 'Enable Author', 'akisa' ), 'section' => 'section_home_mustread', 'type' => 'checkbox', 'active_callback' => 'akisa_mustread_active', ) ); // Number of items $wp_customize->add_setting('theme_options[number_of_mustread_items]', array( 'default' => $default['number_of_mustread_items'], 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'akisa_sanitize_number_range' ) ); $wp_customize->add_control('theme_options[number_of_mustread_items]', array( 'label' => __('Number of Items', 'akisa'), 'description' => __('Save & Refresh the customizer to see its effect. Maximum is 24(Pro).', 'akisa'), 'section' => 'section_home_mustread', 'settings' => 'theme_options[number_of_mustread_items]', 'type' => 'number', 'active_callback' => 'akisa_mustread_active', 'input_attrs' => array( 'min' => 1, 'max' => 4, 'step' => 1, ), ) ); $number_of_mustread_items = akisa_get_option( 'number_of_mustread_items' ); for( $i=1; $i<=$number_of_mustread_items; $i++ ){ // Posts $wp_customize->add_setting('theme_options[mustread_post_'.$i.']', array( 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'akisa_dropdown_pages' ) ); $wp_customize->add_control('theme_options[mustread_post_'.$i.']', array( 'label' => sprintf( __('Select Post #%1$s', 'akisa'), $i), 'section' => 'section_home_mustread', 'settings' => 'theme_options[mustread_post_'.$i.']', 'type' => 'select', 'choices' => akisa_post_choices(), 'active_callback' => 'akisa_mustread_active', ) ); }