Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * [events_list event_type="demo"]
- * replace attribute_name with your custom event attribute name
- */
- function em_event_types_get_default_search($searches, $array)
- {
- if( !empty($array['event_type'])){
- $searches['event_type'] = $array['event_type'];
- }
- return $searches;
- }
- add_filter('em_events_get_default_search','em_event_types_get_default_search',1,2);
- add_filter('em_events_get','em_event_types_events_get',1,2);
- function em_event_types_events_get($events, $args)
- {
- if( !empty($args['event_type'])){
- $event_types = explode(',', $args['event_type']);
- foreach($events as $event_key => $EM_Event){
- if( !in_array($EM_Event->event_attributes['attribute_name'], $event_types) ){
- unset($events[$event_key]);
- }
- }
- }
- return $events;
- }
Add Comment
Please, Sign In to add comment