SHARE
TWEET

Count Events Per Category

eventsmanager Dec 3rd, 2015 202 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  * this snippet will display the number of events per category
  3.  */
  4. add_filter('em_category_output_placeholder','my_event_count_placeholder',1,3);
  5. function my_event_count_placeholder($replace, $EM_Category, $result){
  6.         switch( $result ){
  7.                 case '#_EVENTCOUNT':
  8.                         $replace = '0';
  9.                         $eventCount = EM_Events::count(array('category'=>$EM_Category->term_id));
  10.                         if( $eventCount > 0 ){
  11.                                 $replace = $eventCount;
  12.                         }
  13.                         break;
  14.         }
  15.         return $replace;
  16. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top