Skip to content

Commit 56a1083

Browse files
committed
Display "Free" instead of 0.00$
1 parent b2d4803 commit 56a1083

1 file changed

Lines changed: 31 additions & 2 deletions

File tree

mu-plugins/osi-events-manager-tweaks/osi-events-manager-tweaks.php

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,17 @@
77
* Author URI: https://wpspecialprojects.wordpress.com/
88
*/
99

10-
add_filter('em_event_output_placeholder', 'osi_em_event_output_placeholder', 10, 5);
10+
/**
11+
* Remove the event time zone if the event is all day.
12+
*
13+
* @param string $replace The string to replace.
14+
* @param EM_Event $EM_Event The event object.
15+
* @param string $full_result The full result.
16+
* @param string $target The target.
17+
* @param array $placeholder_atts The placeholder attributes.
18+
*
19+
* @return string
20+
*/
1121
function osi_em_event_output_placeholder( $replace, $EM_Event, $full_result, $target, $placeholder_atts ) {
1222
if ( '#_EVENTTIMEZONE' === $full_result ) {
1323
$event_times = $EM_Event->output('#_EVENTTIMES');
@@ -16,4 +26,23 @@ function osi_em_event_output_placeholder( $replace, $EM_Event, $full_result, $ta
1626
}
1727
}
1828
return $replace;
19-
}
29+
}
30+
add_filter('em_event_output_placeholder', 'osi_em_event_output_placeholder', 10, 5);
31+
32+
/**
33+
* Display "Free" for events with a price of 0.00.
34+
*
35+
* @param string $formatted_price The formatted price.
36+
* @param string $price The price.
37+
* @param string $currency The currency.
38+
* @param string $format The format.
39+
* @return void
40+
*/
41+
function osi_format_event_manager_price( $formatted_price, $price, $currency, $format ) {
42+
if( 0.00 === (float)$price ) {
43+
$formatted_price = 'Free';
44+
}
45+
46+
return $formatted_price;
47+
}
48+
add_filter('em_get_currency_formatted', 'osi_format_event_manager_price', 10, 4 );

0 commit comments

Comments
 (0)