Advertisement
Guest User

wp-travel-customize

a guest
Nov 27th, 2018
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.04 KB | None | 0 0
  1. function wp_travel_customize_sale_price_display( $s, $c, $d ) {
  2. return sprintf( esc_html__('Prix à partir de %1s %2s', 'wp-travel' ), $c , $d );
  3. }
  4. add_filter( 'wp_travel_itinerary_sale_price', 'wp_travel_customize_sale_price_display', 99, 3 );
  5. function wp_travel_customize_price_display( $s, $c, $d ) {
  6. global $wp_travel_itinerary;
  7. if ( $wp_travel_itinerary && $wp_travel_itinerary->is_sale_enabled() ) {
  8. return sprintf( esc_html__('From %1s %2s', 'wp-travel' ), $c , $d );
  9. // return $s;
  10. }
  11. return sprintf( esc_html__('From %1s %2s', 'wp-travel' ), $c , $d );
  12. }
  13. add_filter( 'wp_travel_itinerary_price', 'wp_travel_customize_price_display', 99, 3 );
  14.  
  15. function wp_travel_trip_price_customize( $post_id, $hide_rating = false ) {
  16.     $settings = wp_travel_get_settings();
  17.     $trip_price     = wp_travel_get_trip_price( $post_id );
  18.     $enable_sale    = get_post_meta( $post_id, 'wp_travel_enable_sale', true );
  19.     $sale_price     = wp_travel_get_trip_sale_price( $post_id );
  20.     $currency_code  = ( isset( $settings['currency'] ) ) ? $settings['currency'] : '';
  21.     $currency_symbol = wp_travel_get_currency_symbol( $currency_code );
  22.     $per_person_text = wp_travel_get_price_per_text( $post_id );
  23.     // $wp_travel_itinerary = new WP_Travel_Itinerary();
  24.     ?>
  25.     <div class="wp-detail-review-wrap">
  26.         <?php do_action( 'wp_travel_single_before_trip_price', $post_id, $hide_rating ); ?>
  27.         <div class="wp-travel-trip-detail">    
  28.         <?php if ( '' != $trip_price || '0' != $trip_price ) : ?>
  29.             <div class="trip-price" >
  30.             <?php if ( $enable_sale ) : ?>
  31.                 <del>
  32.                     <span><?php echo apply_filters( 'wp_travel_itinerary_price', sprintf( ' %s %s ', $currency_symbol, $trip_price ), $currency_symbol, $trip_price ); ?></span>
  33.                 </del>
  34.             <?php endif; ?>
  35.                 <span class="person-count">
  36.                     <ins>
  37.                         <span>
  38.                             <?php
  39.                             if ( $enable_sale ) {
  40.                                 echo apply_filters( 'wp_travel_itinerary_sale_price', sprintf( ' %s %s', $currency_symbol, $sale_price ), $currency_symbol, $sale_price );
  41.                             } else {
  42.                                 echo apply_filters( 'wp_travel_itinerary_price', sprintf( ' %s %s ', $currency_symbol, $trip_price ), $currency_symbol, $trip_price );
  43.                             }
  44.                             ?>
  45.                         </span>
  46.                     </ins>  
  47.                     <?php if ( ! empty( $per_person_text ) ) : ?>
  48.                         /<?php echo esc_html( $per_person_text ); ?>
  49.                     <?php endif; ?>                
  50.                 </span>
  51.             </div>
  52.         <?php endif; ?>
  53.         </div>
  54.         <?php do_action( 'wp_travel_single_after_trip_price', $post_id, $hide_rating ); ?>
  55.     </div>
  56. <?php
  57. }
  58. remove_action(  'wp_travel_after_single_title', 'wp_travel_trip_price', 1 );
  59. add_action( 'wp_travel_after_single_title', 'wp_travel_trip_price_customize', 0 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement