Created
February 22, 2018 06:20
-
-
Save anonymous/283fb3160d26f8ed1f89f4324f649ad6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function wp_travel_custom_trip_single_excerpt(){ | |
remove_action( 'wp_travel_after_single_title', 'wp_travel_single_excerpt', 1 ); | |
add_action( 'wp_travel_after_single_title', 'wp_travel_custom_single_excerpt_customize', 1 ); | |
} | |
add_action('wp', 'wp_travel_custom_trip_single_excerpt', 99); | |
function wp_travel_custom_single_excerpt_customize( $post_id ) { | |
if ( ! $post_id ) { | |
return; | |
} | |
//Get Settings | |
$settings = wp_travel_get_settings(); | |
$enquery_global_setting = isset( $settings['enable_trip_enquiry_option'] ) ? $settings['enable_trip_enquiry_option'] : 'yes'; | |
$global_enquiry_option = get_post_meta( $post_id, 'wp_travel_use_global_trip_enquiry_option', true ); | |
if ( '' === $global_enquiry_option ) { | |
$global_enquiry_option = 'yes'; | |
} | |
if( 'yes' == $global_enquiry_option ) { | |
$enable_enquiry = $enquery_global_setting; | |
} | |
else { | |
$enable_enquiry = get_post_meta( $post_id, 'wp_travel_enable_trip_enquiry_option', true ); | |
} | |
$wp_travel_itinerary = new WP_Travel_Itinerary(); | |
?> | |
<div class="trip-short-desc"> | |
<?php the_excerpt(); ?> | |
</div> | |
<div class="wp-travel-trip-meta-info"> | |
<ul> | |
<?php | |
/** | |
* @since 1.0.4 | |
*/ | |
do_action( 'wp_travel_single_itinerary_before_trip_meta_list', $post_id ); | |
?> | |
<li> | |
<div class="travel-info"> | |
<strong class="title"><?php esc_html_e( 'Trip Type', 'wp-travel' ); ?></strong> | |
</div> | |
<div class="travel-info"> | |
<span class="value"> | |
<?php | |
$trip_types_list = $wp_travel_itinerary->get_trip_types_list(); | |
if ( $trip_types_list ) { | |
echo wp_kses( $trip_types_list, wp_travel_allowed_html( array( 'a' ) ) ); | |
} else { | |
echo esc_html( apply_filters( 'wp_travel_default_no_trip_type_text', __( 'No trip type', 'wp-travel' ) ) ); | |
} | |
?> | |
</span> | |
</div> | |
</li> | |
<li> | |
<div class="travel-info"> | |
<strong class="title"><?php esc_html_e( 'Activities', 'wp-travel' ); ?></strong> | |
</div> | |
<div class="travel-info"> | |
<span class="value"> | |
<?php | |
$activity_list = $wp_travel_itinerary->get_activities_list(); | |
if ( $activity_list ) { | |
echo wp_kses( $activity_list, wp_travel_allowed_html( array( 'a' ) ) ); | |
} else { | |
echo esc_html( apply_filters( 'wp_travel_default_no_activity_text', __( 'No Activities', 'wp-travel' ) ) ); | |
} | |
?> | |
</span> | |
</div> | |
</li> | |
<li> | |
<div class="travel-info"> | |
<strong class="title"><?php esc_html_e( 'Group Size', 'wp-travel' ); ?></strong> | |
</div> | |
<div class="travel-info"> | |
<span class="value"> | |
<?php | |
if ( $group_size = $wp_travel_itinerary->get_group_size() ) { | |
printf( __( '%d pax ', 'wp-travel' ), esc_html( $group_size ) ); | |
} else { | |
echo esc_html( apply_filters( 'wp_travel_default_group_size_text', __( 'No Size Limit', 'wp-travel' ) ) ); | |
} | |
?> | |
</span> | |
</div> | |
</li> | |
<?php if ( comments_open() ) : ?> | |
<li> | |
<div class="travel-info"> | |
<strong class="title"><?php esc_html_e( 'Reviews', 'wp-travel' ); ?></strong> | |
</div> | |
<div class="travel-info"> | |
<span class="value"> | |
<?php | |
$count = (int) get_comments_number(); | |
echo '<a href="javascript:void(0)" class="wp-travel-count-info">'; | |
printf( _n( '%s review', '%s reviews', $count, 'wp-travel' ), $count ); | |
echo '</a>'; ?> | |
</span> | |
</div> | |
</li> | |
<?php endif; ?> | |
<?php | |
/** | |
* @since 1.0.4 | |
*/ | |
do_action( 'wp_travel_single_itinerary_after_trip_meta_list', $post_id ); | |
?> | |
</ul> | |
</div> | |
<div class="booking-form"> | |
<div class="wp-travel-booking-wrapper"> | |
<button class="wp-travel-booknow-btn"><?php esc_html_e( 'Book Now', 'wp-travel' ); ?></button> | |
<?php if ( 'yes' == $enable_enquiry ) : ?> | |
<a id="wp-travel-send-enquiries" href="#wp-travel-enquiries"> | |
<span class="wp-travel-booking-enquiry"> | |
<span class="dashicons dashicons-editor-help"></span> | |
<span> | |
<?php esc_html_e( 'Trip Enquiry', 'wp-travel'); ?> | |
</span> | |
</span> | |
</a> | |
<?php endif; ?> | |
</div> | |
</div> | |
<?php | |
if ( 'yes' == $enable_enquiry ) : | |
wp_travel_get_enquiries_form(); | |
endif; | |
?> | |
<?php | |
/** | |
* @since 1.0.4 | |
*/ | |
do_action( 'wp_travel_single_after_booknow', $post_id ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment