add_section( 'ankitrawat_section_featured', array( 'title' => esc_html__( 'Featured Posts', 'ankit-rawat' ), 'priority' => 60, 'panel' => 'ankitrawat_options_panel', ) ); // Add settings and controls for Featured Posts. $wp_customize->add_setting( 'ankitrawat_theme_options[featured_activate]', array( 'default' => '', 'type' => 'option', 'transport' => 'refresh', 'sanitize_callback' => 'esc_attr', ) ); $wp_customize->add_control( new Gridbox_Customize_Header_Control( $wp_customize, 'ankitrawat_theme_options[featured_activate]', array( 'label' => esc_html__( 'Activate Featured Posts', 'ankit-rawat' ), 'section' => 'ankitrawat_section_featured', 'settings' => 'ankitrawat_theme_options[featured_activate]', 'priority' => 1, ) ) ); $wp_customize->add_setting( 'ankitrawat_theme_options[featured_magazine]', array( 'default' => false, 'type' => 'option', 'transport' => 'refresh', 'sanitize_callback' => 'ankitrawat_sanitize_checkbox', ) ); $wp_customize->add_control( 'ankitrawat_theme_options[featured_magazine]', array( 'label' => esc_html__( 'Show featured posts on Magazine Homepage', 'ankit-rawat' ), 'section' => 'ankitrawat_section_featured', 'settings' => 'ankitrawat_theme_options[featured_magazine]', 'type' => 'checkbox', 'priority' => 2, ) ); $wp_customize->add_setting( 'ankitrawat_theme_options[featured_blog]', array( 'default' => false, 'type' => 'option', 'transport' => 'refresh', 'sanitize_callback' => 'ankitrawat_sanitize_checkbox', ) ); $wp_customize->add_control( 'ankitrawat_theme_options[featured_blog]', array( 'label' => esc_html__( 'Show featured posts on posts page', 'ankit-rawat' ), 'section' => 'ankitrawat_section_featured', 'settings' => 'ankitrawat_theme_options[featured_blog]', 'type' => 'checkbox', 'priority' => 3, ) ); // Add Setting and Control for Featured Posts Category. $wp_customize->add_setting( 'ankitrawat_theme_options[featured_category]', array( 'default' => 0, 'type' => 'option', 'transport' => 'refresh', 'sanitize_callback' => 'absint', ) ); $wp_customize->add_control( new Gridbox_Customize_Category_Dropdown_Control( $wp_customize, 'ankitrawat_theme_options[featured_category]', array( 'label' => esc_html__( 'Featured Posts Category', 'ankit-rawat' ), 'section' => 'ankitrawat_section_featured', 'settings' => 'ankitrawat_theme_options[featured_category]', 'priority' => 4, ) ) ); } add_action( 'customize_register', 'ankitrawat_customize_register_featured_settings' );