add_section( 'buzzhub_recent_news', array( 'title' => esc_html__( 'Recent News Section', 'buzzhub' ), 'panel' => 'buzzhub_home_panel', ) ); // recent_news enable settings $wp_customize->add_setting( 'buzzhub_recent_news', array( 'sanitize_callback' => 'buzzhub_sanitize_select', 'default' => 'disable' ) ); $wp_customize->add_control( 'buzzhub_recent_news', array( 'section' => 'buzzhub_recent_news', 'label' => esc_html__( 'Content type:', 'buzzhub' ), 'description' => esc_html__( 'Choose where you want to render the content from.', 'buzzhub' ), 'type' => 'select', 'choices' => array( 'disable' => esc_html__( '--Disable--', 'buzzhub' ), 'post' => esc_html__( 'Post', 'buzzhub' ), ) ) ); $wp_customize->add_setting( 'buzzhub_recent_news_title', array( 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'postMessage', 'default' => __('Choose Your Perfect Plan', 'buzzhub'), ) ); $wp_customize->add_control( 'buzzhub_recent_news_title', array( 'section' => 'buzzhub_recent_news', 'label' => esc_html__( 'Title:', 'buzzhub' ), 'active_callback' => 'buzzhub_if_recent_news_enabled', ) ); $wp_customize->selective_refresh->add_partial( 'buzzhub_recent_news_title', array( 'selector' => '#recent-news h2.section-title', 'render_callback' => 'buzzhub_recent_news_partial_title', ) ); $recent_news_count = 3; for ($i=1; $i <= $recent_news_count ; $i++) { // recent_news post setting $wp_customize->add_setting( 'buzzhub_recent_news_post_'.$i, array( 'sanitize_callback' => 'buzzhub_sanitize_dropdown_pages', ) ); $wp_customize->add_control( 'buzzhub_recent_news_post_'.$i, array( 'section' => 'buzzhub_recent_news', 'label' => esc_html__( 'Post ', 'buzzhub' ).$i, 'active_callback' => 'buzzhub_if_recent_news_post', 'type' => 'select', 'choices' => buzzhub_get_post_choices(), ) ); }