add_section( 'best_seller_section', array( 'title' => __( 'Best Seller Section', 'adventure-travel' ), 'priority' => 25, 'panel' => 'frontpage_settings', ) ); $wp_customize->add_setting( 'ed_best_seller_section', array( 'default' => true, 'sanitize_callback' => 'adventure_travel_sanitize_select' ) ); $wp_customize->add_control( 'ed_best_seller_section', array( 'label' => __( 'Enable Best Seller', 'adventure-travel' ), 'section' => 'best_seller_section', 'type' => 'checkbox', 'priority' => 10, ) ); /** Title */ $wp_customize->add_setting( 'best_seller_title', array( 'default' => __( 'Best Seller', 'adventure-travel' ), 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'postMessage' ) ); $wp_customize->add_control( 'best_seller_title', array( 'label' => __( 'Besy Seller Title', 'adventure-travel' ), 'section' => 'best_seller_section', 'type' => 'text', ) ); /** desc */ $wp_customize->add_setting( 'best_seller_desc', array( 'default' => __( 'you can find the best selling trips here', 'adventure-travel' ), 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'postMessage' ) ); $wp_customize->add_control( 'best_seller_desc', array( 'label' => __( 'Best Seller Desc', 'adventure-travel' ), 'section' => 'best_seller_section', 'type' => 'text', ) ); if( Adventure_Travel_is_wp_travel_engine_activated() ){ for ( $i = 1; $i <= 6; $i++ ) { $wp_customize->add_setting( "best_seller_trip_$i", array( 'sanitize_callback' => 'adventure_travel_sanitize_select', ) ); $wp_customize->add_control( "best_seller_trip_$i", array( 'label' => esc_html__( 'Best Seller trip', 'adventure-travel' ) . ' - ' . $i, 'section' => 'best_seller_section', 'type' => 'select', 'choices' => adventure_travel_get_posts( 'trip' ), ) ); } } else { $wp_customize->add_setting( 'best_seller_recommend', array( 'sanitize_callback' => 'wp_kses_post', ) ); $wp_customize->add_control( new Adventure_Travel_Plugin_Recommend_Control( $wp_customize, 'best_seller_recommend', array( 'section' => 'best_seller_section', 'label' => __( 'Choose Best Seller Trip', 'adventure-travel' ), 'capability' => 'install_plugins', 'plugin_slug' => 'wp-travel-engine',//This is the slug of recommended plugin. /* translators: 1: strong tag start, 2: strong tag end */ 'description' => sprintf( __( 'Please install and activate the recommended plugin %1$s WP Travel Engine %2$s. After that option related with this section will be visible.', 'adventure-travel' ), '', '' ), ) ) ); } } add_action( 'customize_register', 'adventure_travel_customize_register_frontpage_best_seller_section' );