Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function wp_travel_customize_sale_price_display( $s, $c, $d ) {
- return sprintf( esc_html__('Prix à partir de %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_after_single_title', 'wp_travel_trip_price', 1 );
- add_action( 'wp_travel_after_single_title', 'wp_travel_trip_price_customize', 0 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement