add_setting( 'businessmax_options[blog_section]' , array( 'default' => $option['blog_section'], 'sanitize_callback' => 'business_max_sanitize_checkbox', 'type'=>'option' )); $wp_customize->add_control('businessmax_options[blog_section]' , array( 'label' => __('Blog Enable','business-max' ), 'section' => 'blog_section', 'type'=>'checkbox', ) ); $wp_customize->add_setting( 'businessmax_options[blog_title]' , array( 'default' => $option['blog_title'], 'sanitize_callback' => 'sanitize_text_field', 'type'=>'option' )); $wp_customize->add_control('businessmax_options[blog_title]' , array( 'label' => __('Section Title','business-max' ), 'section' => 'blog_section', 'type'=>'text', ) ); $wp_customize->add_setting( 'businessmax_options[blog_subtitle]' , array( 'default' => $option['blog_subtitle'], 'sanitize_callback' => 'sanitize_text_field', 'type'=>'option' )); $wp_customize->add_control('businessmax_options[blog_subtitle]' , array( 'label' => __('Section Subtitle','business-max' ), 'section' => 'blog_section', 'type'=>'text', ) ); $wp_customize->add_setting( 'businessmax_options[blog_noofshow]' , array( 'default' => $option['blog_noofshow'], 'sanitize_callback' => 'sanitize_text_field', 'type'=>'option' )); $wp_customize->add_control('businessmax_options[blog_noofshow]' , array( 'label' => __('No. of posts to show','business-max' ), 'section' => 'blog_section', 'type'=>'select', 'choices' => array( 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, ) ) ); $wp_customize->add_setting( 'businessmax_options[blog_orderby]' , array( 'default' => $option['blog_orderby'], 'sanitize_callback' => 'sanitize_text_field', 'type'=>'option' )); $wp_customize->add_control('businessmax_options[blog_orderby]' , array( 'label' => __('Order By:','business-max' ), 'section' => 'blog_section', 'type'=>'select', 'choices' => array( 'default' => esc_html__('Default', 'business-max'), 'id' => esc_html__('ID', 'business-max'), 'author' => esc_html__('Author', 'business-max'), 'title' => esc_html__('Title', 'business-max'), 'date' => esc_html__('Date', 'business-max'), 'comment_count' => esc_html__('Comment Count', 'business-max'), 'menu_order' => esc_html__('Order by Page Order', 'business-max'), 'rand' => esc_html__('Random order', 'business-max'), ) ) ); $wp_customize->add_setting( 'businessmax_options[blog_order]' , array( 'default' => $option['blog_order'], 'sanitize_callback' => 'sanitize_text_field', 'type'=>'option' )); $wp_customize->add_control('businessmax_options[blog_order]' , array( 'label' => __('Order','business-max' ), 'section' => 'blog_section', 'type'=>'select', 'choices' => array( 'desc' => esc_html__('Descending', 'business-max'), 'asc' => esc_html__('Ascending', 'business-max'), ) ) ); $categories = get_categories( array( 'hide_empty' => 1, ) ); $cats = array(); foreach($categories as $cat){ $cats[$cat->term_id] = $cat->name; } $wp_customize->add_setting( 'businessmax_options[blog_cat]' , array( 'default' => $option['blog_cat'], 'sanitize_callback' => 'sanitize_text_field', 'type'=>'option' )); $wp_customize->add_control('businessmax_options[blog_cat]' , array( 'label' => __('Blog Category','business-max' ), 'section' => 'blog_section', 'type'=>'select', 'choices' => $cats ) ); } add_action( 'customize_register', 'business_max_blogsection_setting' );