Advertisement
eventsmanager

Count Events Per Category

Dec 3rd, 2015
843
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement