Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- This snippet will add new placeholder to display how many upcoming events
- this location has.
- */
- function em_location_event_count($replace, $EM_Location, $result){
- global $wp_query, $wp_rewrite;
- switch( $result ){
- case '#_LOCATIONEVENTCOUNT':
- $replace = "0";
- $events = EM_Events::get(array('location'=>$EM_Location->location_id,'scope'=>'future'));
- if ( count($events) > 0 ){
- $replace = count($events);
- }
- $replace = "There are ".$replace." events in this location";
- break;
- }
- return $replace;
- }
- add_filter('em_location_output_placeholder','em_location_event_count',1,3);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement