Title: Filter Events List problem
Last modified: August 30, 2016

---

# Filter Events List problem

 *  Resolved [fersamp](https://wordpress.org/support/users/fersamp/)
 * (@fersamp)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/filter-events-list-problem/)
 * Hi everyone,
 * I tried to use filter today-tomorrow but it doesn’t work even if I use it directly
   🙁 …
    I would like to start from that filter to implement a filter by a single
   date passed from datepicker, more complex…why this is not working? This should
   filter for today ( even is just implemented from authors, I would like to understand
   how to use the filter manually )
 *     ```
       add_filter( 'em_events_build_sql_conditions', 'my_em_scope_conditions',1,2);
       function my_em_scope_conditions($conditions, $args){
       	if( !empty($args['scope']) && $args['scope']=='my_custom_date' ){
       		$start_date = date('Y-m-d', current_time('timestamp'));
       		$end_date = date('Y-m-d', current_time('timestamp'));
       		$conditions['scope'] = " (event_start_date BETWEEN CAST('$start_date' AS DATE) AND CAST('$end_date' AS DATE)) OR (event_end_date BETWEEN CAST('$end_date' AS DATE) AND CAST('$start_date' AS DATE))";
       	}
       	return $conditions;
       }
   
       add_filter( 'em_get_scopes','my_em_scopes',1,1);
       function my_em_scopes($scopes){
       	$my_scopes = array(
       		'my_custom_date' => 'My custom date'
       	);
       	return $scopes + $my_scopes;
       }
       ```
   
 * [https://wordpress.org/plugins/events-manager/](https://wordpress.org/plugins/events-manager/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Support [angelo_nwl](https://wordpress.org/support/users/angelo_nwl/)
 * (@angelo_nwl)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/filter-events-list-problem/#post-6815181)
 * hi,
 * is the above is your actual custom scope? also, did you used it in a shortcode
   or somewhere else?
 * thanks
 *  Thread Starter [fersamp](https://wordpress.org/support/users/fersamp/)
 * (@fersamp)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/filter-events-list-problem/#post-6815187)
 * I only paste this in my functions.php. The scope appears in backend but it seems
   not working…How can I filter only by one single date? How is it the correct steps
   to implement filters? I read the tutorial but I didn’t understand which files
   I have to change

Viewing 2 replies - 1 through 2 (of 2 total)

 The topic ‘Filter Events List problem’ is closed to new replies.

 * ![](https://ps.w.org/events-manager/assets/icon-256x256.gif?rev=3711454)
 * [Events Manager - Calendar, Bookings, Tickets, Appointments and more!](https://wordpress.org/plugins/events-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/events-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/events-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/events-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/events-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/events-manager/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [fersamp](https://wordpress.org/support/users/fersamp/)
 * Last activity: [10 years, 10 months ago](https://wordpress.org/support/topic/filter-events-list-problem/#post-6815187)
 * Status: resolved