Advertisement
supportnwl

Untitled

Mar 21st, 2013
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. function em_location_types_accepted_searches($searches)
  2. {
  3. $searches[] = 'location_type';
  4. return $searches;
  5. }
  6. add_filter('em_accepted_searches','em_location_types_accepted_searches',1,1);
  7.  
  8. function em_location_types_get_default_search($searches, $array)
  9. {
  10. if( !empty($array['location_type'])){
  11. $searches['location_type'] = $array['location_type'];
  12. }
  13. return $searches;
  14. }
  15. add_filter('em_locations_get_default_search','em_location_types_get_default_search',1,2);
  16.  
  17. function em_location_types_events_get($locations, $args)
  18. {
  19. if( !empty($args['location_type'])){
  20.  
  21. $location_types = explode(',', $args['location_type']);
  22. foreach($locations as $location_key => $EM_Location){
  23. if( !in_array($EM_Location->location_attributes['location_type'], $location_types) ){
  24. unset($locations[$location_key]);
  25. }
  26. }
  27. }
  28. return $events;
  29. }
  30. add_filter('em_locations_get','em_location_types_events_get',1,2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement