Advertisement
eventsmanager

hide recurring events from events list

Apr 29th, 2013
469
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. /*
  2. USAGE: [events_list hide_recurring=1]
  3. */
  4.  
  5. add_filter('em_events_get_default_search','my_em_styles_get_default_search_hide_recurr',1,2);
  6. function my_em_styles_get_default_search_hide_recurr($searches, $array){
  7. if( !empty($array['hide_recurring']) ){
  8. $searches['hide_recurring'] = $array['hide_recurring'];
  9. }
  10. return $searches;
  11. }
  12.  
  13. add_filter('em_events_get','my_em_hide_recurr',1,2);
  14. function my_em_hide_recurr($events, $args){
  15. if( !empty($args['hide_recurring']) && is_numeric($args['hide_recurring']) ){
  16. foreach($events as $event_key => $EM_Event){
  17. if ( !empty($EM_Event->recurrence_id) ){
  18. unset($events[$event_key]);
  19. }
  20. }
  21. }
  22. return $events;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement