Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Exit if accessed directly
- if ( !defined( 'ABSPATH' ) ) exit;
- // BEGIN ENQUEUE PARENT ACTION
- // AUTO GENERATED - Do not modify or remove comment markers above or below:
- // END ENQUEUE PARENT ACTION
- //
- /***** CHANGE FIXED DEP LABEL *****/
- remove_action( 'wp_travel_single_trip_meta_list', 'wp_travel_single_location' );
- add_action( 'wp_travel_single_trip_meta_list', 'wp_travel_child_single_location' );
- function wp_travel_child_single_location( $post_id ) {
- if ( ! $post_id ) {
- return;
- }
- $terms = get_the_terms( $post_id, 'travel_locations' );
- $start_date = get_post_meta( $post_id, 'wp_travel_start_date', true );
- $end_date = get_post_meta( $post_id, 'wp_travel_end_date', true );
- $fixed_departure = get_post_meta( $post_id, 'wp_travel_fixed_departure', true );
- $fixed_departure = ( $fixed_departure ) ? $fixed_departure : 'yes';
- $fixed_departure = apply_filters( 'wp_travel_fixed_departure_defalut', $fixed_departure );
- $trip_duration = get_post_meta( $post_id, 'wp_travel_trip_duration', true );
- $trip_duration = ( $trip_duration ) ? $trip_duration : 0;
- $trip_duration_night = get_post_meta( $post_id, 'wp_travel_trip_duration_night', true );
- $trip_duration_night = ( $trip_duration_night ) ? $trip_duration_night : 0;
- ?>
- <?php if ( 'yes' === $fixed_departure ) : ?>
- <?php if ( $start_date && $end_date ) : ?>
- <li>
- <div class="travel-info">
- <strong class="title"><?php esc_html_e( 'Seasonal Rates', 'wp-travel' ); ?></strong>
- </div>
- <div class="travel-info">
- <span class="value">
- <?php $date_format = get_option( 'date_format' ); ?>
- <?php if ( ! $date_format ) : ?>
- <?php $date_format = 'jS M, Y'; ?>
- <?php endif; ?>
- <?php printf( '%s - %s', date( $date_format, strtotime( $start_date ) ), date( $date_format, strtotime( $end_date ) ) ); ?>
- </span>
- </div>
- </li>
- <?php endif; ?>
- <?php else : ?>
- <?php if ( $trip_duration || $trip_duration_night ) : ?>
- <li>
- <div class="travel-info">
- <strong class="title"><?php esc_html_e( 'Trip Duration', 'wp-travel' ); ?></strong>
- </div>
- <div class="travel-info">
- <span class="value">
- <?php printf( __( '%s Day(s) %s Night(s)', 'wp-travel' ), $trip_duration, $trip_duration_night ); ?>
- </span>
- </div>
- </li>
- <?php endif; ?>
- <?php endif; ?>
- <li>
- <div class="travel-info">
- <strong class="title">Experiences Dates</strong>
- </div>
- <div class="travel-info">
- <span class="value">
- Check the calendar under the Booking Tab. If there's no date available: click on "Trip enquiry"
- </span>
- </div>
- </li>
- <?php
- }
- /***** END CHANGE FIXED DEP LABEL *****/
- /**** Additional Info on single trip page ****/
- function wp_travel_travel_info_customize(){
- ?>
- <?php
- }
- // add_action('wp_travel_single_trip_meta_list','wp_travel_travel_info_customize');
- /**** End Additional Info on single trip page ****/
- /******** SHOW BOOKING PAYMENT ONLY ON CART ********/
- function wp_travel_customize_booking_option($fields){
- $fields['payment_fields']['booking_option'] = array(
- 'type' => 'select',
- 'label' => 'Booking Options',
- 'name' => 'wp_travel_booking_option',
- 'id' => 'wp-travel-option',
- 'validations' => array(
- 'required' => 1
- ),
- 'options' => array('booking_payment_only' => 'Booking payment only' ),
- 'default' => 'booking_payment_only',
- 'priority' => 100
- );
- return $fields;
- }
- add_filter( 'wp_travel_checkout_fields', 'wp_travel_customize_booking_option' );
- /******** SHOW BOOKING PAYMENT ONLY ON CART END ********/
- /******** CHANGE TEXT ON PLACEHOLDER ********/
- function wp_travel_child_search_placeholder_text(){
- return esc_html__( 'Ex: Walking tour', 'wp-travel' );
- }
- add_filter('wp_travel_search_placeholder','wp_travel_child_search_placeholder_text');
- /******** CHANGE TEXT ON PLACEHOLDER END ********/
- /******** TRIP LISTING VIEW MODE **********/
- add_filter( 'wp_travel_default_view_mode', 'default_view_mode' );
- function default_view_mode( $view_mode ) {
- return 'grid';
- }
- /******** TRIP LISTING VIEW MODE END **********/
- /******** PAX TEXT ********/
- function wp_travel_customize_travel_info_section (){
- return __( '%d People max', 'wp-travel' );
- }
- add_filter ('wp_travel_template_group_size_text','wp_travel_customize_travel_info_section');
- /******** PAX TEXT END ********/
- /***** default country in form field *****/
- function wp_travel_customize_default_country_setting(){
- ?>
- <script type="text/javascript">
- jQuery(document).ready(function(){
- jQuery('#wp-travel-country > option[value="US"]').attr("selected",true);
- });
- </script>
- <?php
- }
- add_action( 'wp_footer', 'wp_travel_customize_default_country_setting', 20 );
- /***** default country in form field end *****/
- /**** Remove Categories Pre-Title ****/
- function wp_travel_child_remove_cat_titles($title) {
- if ( is_archive() ) {
- $title = single_cat_title( '', false );
- } elseif ( is_tag() ) {
- $title = single_tag_title( '', false );
- } elseif ( is_author() ) {
- $title = '<span class="vcard">' . get_the_author() . '</span>' ;
- }
- return $title;
- }
- add_filter( 'get_the_archive_title', 'wp_travel_child_remove_cat_titles' );
- /**** End Remove Categories Pre-Title ****/
- /**** FROM added to price ****/
- function wp_travel_customize_sale_price_display( $s, $c, $d ) {
- return sprintf( esc_html__('From %1s %2s', 'wp-travel' ), $c , $d );
- }
- add_filter( 'wp_travel_itinerary_sale_price', 'wp_travel_customize_sale_price_display', 99, 3 );
- function wp_travel_customize_price_display( $s, $c, $d ) {
- global $wp_travel_itinerary;
- if ( $wp_travel_itinerary && $wp_travel_itinerary->is_sale_enabled() ) {
- return sprintf( esc_html__('From %1s %2s', 'wp-travel' ), $c , $d );
- // return $s;
- }
- return sprintf( esc_html__('From %1s %2s', 'wp-travel' ), $c , $d );
- }
- add_filter( 'wp_travel_itinerary_price', 'wp_travel_customize_price_display', 99, 3 );
- function wp_travel_trip_price_customize( $post_id, $hide_rating = false ) {
- $settings = wp_travel_get_settings();
- $trip_price = wp_travel_get_trip_price( $post_id );
- $enable_sale = get_post_meta( $post_id, 'wp_travel_enable_sale', true );
- $sale_price = wp_travel_get_trip_sale_price( $post_id );
- $currency_code = ( isset( $settings['currency'] ) ) ? $settings['currency'] : '';
- $currency_symbol = wp_travel_get_currency_symbol( $currency_code );
- $per_person_text = wp_travel_get_price_per_text( $post_id );
- // $wp_travel_itinerary = new WP_Travel_Itinerary();
- ?>
- <div class="wp-detail-review-wrap">
- <?php do_action( 'wp_travel_single_before_trip_price', $post_id, $hide_rating ); ?>
- <div class="wp-travel-trip-detail">
- <?php if ( '' != $trip_price || '0' != $trip_price ) : ?>
- <div class="trip-price" >
- <?php if ( $enable_sale ) : ?>
- <del>
- <span><?php echo apply_filters( 'wp_travel_itinerary_price', sprintf( ' %s %s ', $currency_symbol, $trip_price ), $currency_symbol, $trip_price ); ?></span>
- </del>
- <?php endif; ?>
- <span class="person-count">
- <ins>
- <span>
- <?php
- if ( $enable_sale ) {
- echo apply_filters( 'wp_travel_itinerary_sale_price', sprintf( ' %s %s', $currency_symbol, $sale_price ), $currency_symbol, $sale_price );
- } else {
- echo apply_filters( 'wp_travel_itinerary_price', sprintf( ' %s %s ', $currency_symbol, $trip_price ), $currency_symbol, $trip_price );
- }
- ?>
- </span>
- </ins>
- <?php if ( ! empty( $per_person_text ) ) : ?>
- /<?php echo esc_html( $per_person_text ); ?>
- <?php endif; ?>
- </span>
- </div>
- <?php endif; ?>
- </div>
- <?php do_action( 'wp_travel_single_after_trip_price', $post_id, $hide_rating ); ?>
- </div>
- <?php
- }
- remove_action( 'wp_travel_single_trip_after_title', 'wp_travel_trip_price', 1 );
- add_action( 'wp_travel_single_trip_after_title', 'wp_travel_trip_price_customize', 0 );
- /**** end FROM added to price ****/
- /**** Fixed Dep Title Text change on single trip page ****/
- remove_action( 'wp_travel_single_trip_meta_list', 'wp_travel_single_location', 1 );
- add_action( 'wp_travel_single_trip_meta_list', 'wp_travel_single_location_customize', 1 );
- function wp_travel_single_location_customize( $post_id ) {
- if ( ! $post_id ) {
- return;
- }
- $terms = get_the_terms( $post_id, 'travel_locations' );
- $fixed_departure = get_post_meta( $post_id, 'wp_travel_fixed_departure', true );
- $fixed_departure = ( $fixed_departure ) ? $fixed_departure : 'yes';
- $fixed_departure = apply_filters( 'wp_travel_fixed_departure_defalut', $fixed_departure );
- $trip_duration = get_post_meta( $post_id, 'wp_travel_trip_duration', true );
- $trip_duration = ( $trip_duration ) ? $trip_duration : 0;
- $trip_duration_night = get_post_meta( $post_id, 'wp_travel_trip_duration_night', true );
- $trip_duration_night = ( $trip_duration_night ) ? $trip_duration_night : 0;
- if ( is_array( $terms ) && count( $terms ) > 0 ) :
- ?>
- <li class="no-border">
- <div class="travel-info">
- <strong class="title"><?php esc_html_e( 'Locations', 'wp-travel' ); ?></strong>
- </div>
- <div class="travel-info">
- <span class="value">
- <?php
- $i = 0;
- foreach ( $terms as $term ) :
- if ( $i > 0 ) :
- ?>
- ,
- <?php
- endif;
- ?>
- <span class="wp-travel-locations"><a href="<?php echo esc_url( get_term_link( $term->term_id ) ); ?>"><?php echo esc_html( $term->name ); ?></a></span>
- <?php
- $i++;
- endforeach;
- ?>
- </span>
- </div>
- </li>
- <?php endif; ?>
- <?php if ( 'yes' === $fixed_departure ) :
- if ( $dates = wp_travel_get_fixed_departure_date( $post_id ) ) {
- ?>
- <li>
- <div class="travel-info">
- <strong class="title"><?php esc_html_e( 'Next Experience', 'wp-travel' ); ?></strong>
- </div>
- <div class="travel-info">
- <span class="value">
- <?php echo $dates; ?>
- </span>
- </div>
- </li>
- <?php
- }
- ?>
- <?php else : ?>
- <?php if ( $trip_duration || $trip_duration_night ) : ?>
- <li>
- <div class="travel-info">
- <strong class="title"><?php esc_html_e( 'Trip Duration', 'wp-travel' ); ?></strong>
- </div>
- <div class="travel-info">
- <span class="value">
- <?php printf( __( '%1$s Day(s) %2$s Night(s)', 'wp-travel' ), $trip_duration, $trip_duration_night ); ?>
- </span>
- </div>
- </li>
- <?php endif; ?>
- <?php
- endif;
- }
- /**** End Fixed Dep Title Text change on single trip page ****/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement