add_section( 'blogme_latest_post', array( 'title' => esc_html__( 'Latest Post', 'blogme' ), 'panel' => 'blogme_home_panel', ) ); $wp_customize->add_setting( 'blogme_latest_post_title', array( 'sanitize_callback' => 'sanitize_text_field', 'default' => esc_html__( 'Latest Posts', 'blogme' ), 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'blogme_latest_post_title', array( 'section' => 'blogme_latest_post', 'label' => esc_html__( 'Section Title:', 'blogme' ), 'active_callback' => 'blogme_if_latest_post_enabled' ) ); $wp_customize->add_setting( 'blogme_latest_post_btn_title', array( 'sanitize_callback' => 'sanitize_text_field', 'default' => esc_html__( 'Read More', 'blogme' ), 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'blogme_latest_post_btn_title', array( 'section' => 'blogme_latest_post', 'label' => esc_html__( 'Btn Label:', 'blogme' ), 'active_callback' => 'blogme_if_latest_post_enabled' ) ); $client_num = 5; // client enable settings $wp_customize->add_setting( 'blogme_latest_post', array( 'sanitize_callback' => 'blogme_sanitize_select', 'default' => 'post', ) ); $wp_customize->add_control( 'blogme_latest_post', array( 'section' => 'blogme_latest_post', 'label' => esc_html__( 'Content type:', 'blogme' ), 'description' => esc_html__( 'Choose where you want to render the content from.', 'blogme' ), 'type' => 'select', 'choices' => array( 'disable' => esc_html__( '--Disable--', 'blogme' ), 'post' => esc_html__( 'Post', 'blogme' ), ) ) ); for ($i=1; $i <= $client_num ; $i++) { // client post setting $wp_customize->add_setting( 'blogme_latest_post_post_'.$i, array( 'sanitize_callback' => 'blogme_sanitize_dropdown_pages', ) ); $wp_customize->add_control( 'blogme_latest_post_post_'.$i, array( 'section' => 'blogme_latest_post', 'label' => esc_html__( 'Post ', 'blogme' ).$i, 'active_callback' => 'blogme_if_latest_post_post', 'type' => 'select', 'choices' => blogme_get_post_choices(), ) ); }