RenaReich

Query to remove past events

Jun 7th, 2014
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.00 KB | None | 0 0
  1. // search filter
  2. function fb_search_filter($query) {
  3. if ( !$query->is_admin && $query->is_search) {
  4. $query->set('post_type', array('post', 'page', 'tribe_events', 'tribe_organizer') ); // id of page or post
  5. /*
  6.                                 $today = date("Y-m-d");
  7.                                 $meta_query = array(
  8.                                                 array(
  9.                                                                 'key' => '_EventStartDate',
  10.                                                                 'value' => $today,
  11.                                                                 'compare' => '>'
  12.                                                 )
  13.                                 );
  14.                                 $query->set( 'meta_query', $meta_query );
  15. */
  16. }
  17.  
  18.                 return $query;
  19. }
  20.  
  21. //The code above displays blog posts, pages, all events, and organizers.
  22. //If I uncomment the other code, it displays upcoming events, but not blog posts, pages or organizers.
Add Comment
Please, Sign In to add comment