eventsmanager

Event tag count

Jun 3rd, 2016
228
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. add_filter('em_tag_output_placeholder','my_tag_count_placeholder',1,3);
  2. function my_tag_count_placeholder($replace, $EM_Tag, $result){
  3. switch( $result ){
  4. case '#_TAGCOUNT':
  5. $replace = '0';
  6. $tagCount = EM_Events::count(array( 'tag'=>$EM_Tag->term_id, 'scope' => 'future' ));
  7. if( $tagCount > 0 ){
  8. $replace = $tagCount;
  9. }
  10. break;
  11. }
  12. return $replace;
  13. }
RAW Paste Data