Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter('em_event_output_placeholder','my_em_placeholder_mod_price',1,3);
- function my_em_placeholder_mod_price($replace, $EM_Event, $result){
- if ( $result == '#_EVENTPRICERANGE' ) {
- $min = false;
- $max = 0;
- if( $EM_Event->get_bookings()->is_open() || !empty($show_all_ticket_prices) ){
- foreach( $EM_Event->get_tickets()->tickets as $EM_Ticket ){
- /* @var $EM_Ticket EM_Ticket */
- if( $EM_Ticket->is_available() || get_option('dbem_bookings_tickets_show_unavailable') || !empty($show_all_ticket_prices) ){
- if($EM_Ticket->get_price() > $max ){
- $max = $EM_Ticket->get_price();
- }
- if($EM_Ticket->get_price() < $min || $min === false){
- $min = $EM_Ticket->get_price();
- }
- }
- }
- }
- if( $min === false ) $min = 0;
- if( $min != $max ){
- $replace = ($min > 0) ? em_get_currency_formatted($min).' - '.em_get_currency_formatted($max):'FREE'.' - '.em_get_currency_formatted($max);
- }else{
- $replace = ($min > 0) ? em_get_currency_formatted($min):'FREE';
- }
- }
- return $replace;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement