add_section( 'featured_trip_section', array( 'title' => __( 'Featured Trip Section', 'adventure-travel' ), 'priority' => 25, 'panel' => 'frontpage_settings', ) ); /** Open Link in new tab */ $wp_customize->add_setting( 'ed_featured_trip_section', array( 'default' => true, 'sanitize_callback' => 'adventure_travel_sanitize_checkbox' ) ); $wp_customize->add_control( new Adventure_Travel_Controls_Toggle_Control( $wp_customize, 'ed_featured_trip_section', array( 'section' => 'featured_trip_section', 'label' => __( 'Enable Featured Trip', 'adventure-travel' ), ) ) ); /** Title */ $wp_customize->add_setting( 'featured_trip_title', array( 'default' => __( 'Featured Trip', 'adventure-travel' ), 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'postMessage' ) ); $wp_customize->add_control( 'featured_trip_title', array( 'label' => __( 'Featured Trip Title', 'adventure-travel' ), 'section' => 'featured_trip_section', 'type' => 'text', ) ); /** desc */ $wp_customize->add_setting( 'featured_trip_desc', array( 'default' => __( 'Here you can find the exciting travel and tour packages.', 'adventure-travel' ), 'sanitize_callback' => 'sanitize_text_field', 'transport' => 'postMessage' ) ); $wp_customize->add_control( 'featured_trip_desc', array( 'label' => __( 'Featured Trip Desc', 'adventure-travel' ), 'section' => 'featured_trip_section', 'type' => 'text', ) ); if( Adventure_Travel_is_wp_travel_engine_activated() ){ $featured_trip_no = '6'; for ( $i = 1; $i <= $featured_trip_no; $i++ ) { $wp_customize->add_setting( "featured_trip_$i", array( 'sanitize_callback' => 'adventure_travel_sanitize_select', ) ); $wp_customize->add_control( "featured_trip_$i", array( 'label' => esc_html__( 'Featured Trip ', 'adventure-travel' ) . ' - ' . $i, 'section' => 'featured_trip_section', 'type' => 'select', 'choices' => adventure_travel_get_posts( 'trip' ), ) ); } } else { $wp_customize->add_setting( 'featured_trip_recommend', array( 'sanitize_callback' => 'wp_kses_post', ) ); $wp_customize->add_control( new Adventure_Travel_Plugin_Recommend_Control( $wp_customize, 'featured_trip_recommend', array( 'section' => 'featured_trip_section', 'label' => __( 'Choose Featured 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_featured_trip_section' );