Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- This custom conditional placeholder shows the format per booking spaces available
- sample usage:
- {has_spaces_100}
- #_EVENTNAME
- {/has_spaces_100}
- */
- add_action('em_event_output_condition', 'my_em_custom_event_output_condition', 1, 4);
- function my_em_custom_event_output_condition($replacement, $condition, $match, $EM_Event){
- if( is_object($EM_Event) && preg_match('/^has_spaces_([a-zA-Z0-9_\-]+)$/',$condition, $matches) ){
- $booking_space = $EM_Event->get_bookings()->get_available_spaces();
- if( $booking_space <= $matches[1] ){
- $replacement = preg_replace("/\{\/?$condition\}/", '', $match);
- }else{
- $replacement = '';
- }
- }
- return $replacement;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement