add_section( 'blog_corner_flash_articles_section', array( 'panel' => 'blog_corner_front_page_options', 'title' => esc_html__( 'Flash Articles Section', 'blog-corner' ), ) ); // Flash Articles Section - Enable Section. $wp_customize->add_setting( 'blog_corner_enable_flash_articles_section', array( 'default' => false, 'sanitize_callback' => 'blog_corner_sanitize_switch', ) ); $wp_customize->add_control( new Blog_Corner_Toggle_Switch_Custom_Control( $wp_customize, 'blog_corner_enable_flash_articles_section', array( 'label' => esc_html__( 'Enable Flash Articles Section', 'blog-corner' ), 'section' => 'blog_corner_flash_articles_section', 'settings' => 'blog_corner_enable_flash_articles_section', ) ) ); if ( isset( $wp_customize->selective_refresh ) ) { $wp_customize->selective_refresh->add_partial( 'blog_corner_enable_flash_articles_section', array( 'selector' => '#blog_corner_flash_articles_section .section-link', 'settings' => 'blog_corner_enable_flash_articles_section', ) ); } // Flash Articles Section - Section Title. $wp_customize->add_setting( 'blog_corner_flash_articles_title', array( 'default' => __( 'Flash Articles', 'blog-corner' ), 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'blog_corner_flash_articles_title', array( 'label' => esc_html__( 'Section Title', 'blog-corner' ), 'section' => 'blog_corner_flash_articles_section', 'settings' => 'blog_corner_flash_articles_title', 'type' => 'text', 'active_callback' => 'blog_corner_is_flash_articles_section_enabled', ) ); // Flash Articles Section - Content Type. $wp_customize->add_setting( 'blog_corner_flash_articles_content_type', array( 'default' => 'post', 'sanitize_callback' => 'blog_corner_sanitize_select', ) ); $wp_customize->add_control( 'blog_corner_flash_articles_content_type', array( 'label' => esc_html__( 'Select Content Type', 'blog-corner' ), 'section' => 'blog_corner_flash_articles_section', 'settings' => 'blog_corner_flash_articles_content_type', 'type' => 'select', 'active_callback' => 'blog_corner_is_flash_articles_section_enabled', 'choices' => array( 'post' => esc_html__( 'Post', 'blog-corner' ), 'category' => esc_html__( 'Category', 'blog-corner' ), ), ) ); for ( $i = 1; $i <= 4; $i++ ) { // Flash Articles Section - Select Post. $wp_customize->add_setting( 'blog_corner_flash_articles_content_post_' . $i, array( 'sanitize_callback' => 'absint', ) ); $wp_customize->add_control( 'blog_corner_flash_articles_content_post_' . $i, array( 'label' => sprintf( esc_html__( 'Select Post %d', 'blog-corner' ), $i ), 'section' => 'blog_corner_flash_articles_section', 'settings' => 'blog_corner_flash_articles_content_post_' . $i, 'active_callback' => 'blog_corner_is_flash_articles_section_and_content_type_post_enabled', 'type' => 'select', 'choices' => blog_corner_get_post_choices(), ) ); } // Flash Articles Section - Select Category. $wp_customize->add_setting( 'blog_corner_flash_articles_content_category', array( 'sanitize_callback' => 'blog_corner_sanitize_select', ) ); $wp_customize->add_control( 'blog_corner_flash_articles_content_category', array( 'label' => esc_html__( 'Select Category', 'blog-corner' ), 'section' => 'blog_corner_flash_articles_section', 'settings' => 'blog_corner_flash_articles_content_category', 'active_callback' => 'blog_corner_is_flash_articles_section_and_content_type_category_enabled', 'type' => 'select', 'choices' => blog_corner_get_post_cat_choices(), ) );