G2A Many GEOs
SHARE
TWEET

Filter events listing page by category globally

eventsmanager Aug 10th, 2018 (edited) 191 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  Filter default events listing page by events category globally
  3.  Where 3 is the events category id
  4.  */
  5. function my_em_default_category( $defaults ){
  6.    
  7.     if ( is_array($defaults['category']) && !empty($defaults['category']) ){
  8.         array_push( $defaults['category'], 3 );
  9.     }
  10.     else if ( !is_array($defaults['category']) && !empty($defaults['category']) ){
  11.         $defaults['category'] .= ",3";
  12.     }
  13.     else{
  14.         $defaults['category'] = 3; 
  15.     }
  16.    
  17.     return $defaults;
  18. }
  19. add_filter('em_events_get_default_search','my_em_default_category',100,1);
RAW Paste Data
Ledger Nano X - The secure hardware wallet
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