Advertisement
Guest User

wp-travel-customization

a guest
Jan 24th, 2019
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.62 KB | None | 0 0
  1.  
  2.   function travel_log_child_formatted_currency( $currency_trip_price, $currency_symbol, $trip_price ){
  3.  
  4.                 global $post;
  5.  
  6.                 $post_id = $post->ID;
  7.  
  8.  
  9.                 if ( wp_travel_is_cart_page() ) {
  10.  
  11.                                 if ( isset( $_REQUEST['trip_id'] ) && '' != $_REQUEST['trip_id'] ) {
  12.  
  13.                                                 $post_id = $_REQUEST['trip_id'];
  14.  
  15.                                 }
  16.  
  17.                 }
  18.  
  19.                 $trip_price   = number_format( $trip_price, 2 );
  20.  
  21.                 $enable_sale  = get_post_meta( $post_id, 'wp_travel_enable_sale', true );
  22.  
  23.                 $sale_price   = number_format( wp_travel_get_trip_sale_price( $post_id ), 2 );
  24.  
  25.                 $currency_code  = ( isset( $settings['currency'] ) ) ? $settings['currency'] : '';
  26.  
  27.                 $currency_symbol = wp_travel_get_currency_symbol( $currency_code );
  28.  
  29.   return sprintf( ' %s %s ', $currency_symbol, $trip_price );
  30.  
  31.   }
  32.  
  33.   add_filter( 'wp_travel_itinerary_sale_price', 'travel_log_child_formatted_currency', 10, 3);
  34.   add_filter( 'wp_travel_itinerary_price', 'travel_log_child_formatted_currency', 10, 3 );
  35.  
  36.  
  37.   function wp_travel_customize_price_display( $s, $c, $d ) {
  38.   global $wp_travel_itinerary;
  39.   if ( $wp_travel_itinerary && $wp_travel_itinerary->is_sale_enabled() ) {
  40.      return  sprintf( esc_html__(' %1s %2s', 'wp-travel' ), number_format( $d , 2 ), $c );
  41.     // return $s;
  42.   }
  43.   return sprintf( esc_html__('%1s %2s', 'wp-travel' ), number_format( $d , 2 ), $c );
  44. }
  45. add_filter( 'wp_travel_itinerary_price', 'wp_travel_customize_price_display', 99, 3 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement