Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

#_LOCATIONNEXTEVENTS override

By: supportnwl on Aug 27th, 2012  |  syntax: None  |  size: 0.70 KB  |  views: 265  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. add_filter('em_location_output_placeholder','my_em_placeholder_mod',1,3);
  2. function my_em_placeholder_mod($replace, $EM_Location, $result){
  3.         switch( $result ){
  4.         case '#_LOCATIONNEXTEVENTS':
  5.                 $events = EM_Events::get( array('location'=>$EM_Location->location_id, 'scope'=>'future', 'limit'=>3) );
  6.                 if ( count($events) > 0 ){
  7.                         $replace = get_option('dbem_location_event_list_item_header_format');
  8.                         foreach($events as $event){
  9.                                 $replace .= $event->output(get_option('dbem_location_event_list_item_format'));
  10.                         }
  11.                         $replace .= get_option('dbem_location_event_list_item_footer_format');
  12.                 } else {
  13.                         $replace = get_option('dbem_location_no_events_message');
  14.                 }
  15.                 break;
  16.         }
  17.         return $replace;
  18. }