eventsmanager

Count Events Per Location

Feb 22nd, 2013
211
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2. This snippet will add new placeholder to display how many upcoming events
  3. this location has.
  4. */
  5. function em_location_event_count($replace, $EM_Location, $result){
  6. global $wp_query, $wp_rewrite;
  7. switch( $result ){
  8. case '#_LOCATIONEVENTCOUNT':
  9. $replace = "0";
  10. $events = EM_Events::get(array('location'=>$EM_Location->location_id,'scope'=>'future'));
  11. if ( count($events) > 0 ){
  12. $replace = count($events);
  13. }
  14. $replace = "There are ".$replace." events in this location";
  15. break;
  16. }
  17. return $replace;
  18. }
  19. add_filter('em_location_output_placeholder','em_location_event_count',1,3);
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×