eventsmanager

Filter events listing page by category globally

Aug 10th, 2018
296
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

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×