Title: [Plugin: Events Manager] Search specific date
Last modified: August 20, 2016

---

# [Plugin: Events Manager] Search specific date

 *  Resolved [gmorley](https://wordpress.org/support/users/gmorley/)
 * (@gmorley)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-events-manager-search-specific-date/)
 * I am trying to hack the search form so that users can search a single day, rather
   than a range of dates. I can’t find any of the files that deal with the search
   form besides events-search.php but I can’t figure out how I would edit the date
   fields so that it was just one date. I could easily delete the second box, but
   then the search finds all events on or after the date selected. I only want the
   events on the date selected.
 * I even tried copying the date from one into the other using javascript, and then
   hiding the second one, but somehow the date selector plugin in not allowing the
   onchange javascript function to work. Where is the datepicker code located so
   I can maybe alter that?
 * The website is [http://altitudevip.com/events/](http://altitudevip.com/events/)
   and the test form is the second one. I’m planning to apply all the code to the
   top form once I get it working properly…
 * [http://wordpress.org/extend/plugins/events-manager/](http://wordpress.org/extend/plugins/events-manager/)

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

 *  [agelonwl](https://wordpress.org/support/users/angelonwl/)
 * (@angelonwl)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-events-manager-search-specific-date/#post-2971531)
 * have you tried to see template file at templates/events-list.php
 * [http://wp-events-plugin.com/documentation/using-template-files/](http://wp-events-plugin.com/documentation/using-template-files/)
 *  Thread Starter [gmorley](https://wordpress.org/support/users/gmorley/)
 * (@gmorley)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/plugin-events-manager-search-specific-date/#post-2971684)
 * Yes and I’m not sure exactly how the search is taking place.. It appears when
   you use the search for, it passes specific $args to the event list page, which
   then displays only the events which match those criteria.
 * Is there a way to search by only start date? Most of my events are going to be
   nightclub events, which means they go from 10pm one day, to 3am the following.
   The problem with this is, people search for Saturday, and don’t want to see all
   the Friday events that carried over.
 * I’ll keep trying but so far I’ve only been able to narrow it down to search one
   day, but auto-filling the end date field with what’s chosen in the start date,
   and hiding the end date field from view.
 *  [agelonwl](https://wordpress.org/support/users/angelonwl/)
 * (@angelonwl)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/plugin-events-manager-search-specific-date/#post-2971692)
 * you can hide end date from template file events-search.php and then on events-
   list.php template you can add `$args['scope'] = $_REQUEST['scope'][0];` inside`
   if( get_option('dbem_events_page_search') && !defined('DOING_AJAX') ){`
 *  Thread Starter [gmorley](https://wordpress.org/support/users/gmorley/)
 * (@gmorley)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/plugin-events-manager-search-specific-date/#post-2971699)
 * What I mean is to search by start date, but ignore end date. So if an event starts
   on the 18th, but carries over to the 19th, and you search on the 19th, it won’t
   show said event. it will only show events that START on the 19th
 *  Thread Starter [gmorley](https://wordpress.org/support/users/gmorley/)
 * (@gmorley)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/plugin-events-manager-search-specific-date/#post-2971700)
 * You code worked by taking the scope and instead of returning both start date 
   and end date from the search form, it just displayed the start date. Thank you
   for that, it puts me halfway there. Now I just have to figure out how to alter
   the EM_Events::output ( $args ); to ignore all events that don’t start on the
   searched date. I was thinking a simple “if (event start date != search date) 
   don’t echo” kind of solution but not sure where to alter the output…
 *  Thread Starter [gmorley](https://wordpress.org/support/users/gmorley/)
 * (@gmorley)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/plugin-events-manager-search-specific-date/#post-2971702)
 * SOLVED
 * events manager plugin folder “classes” and file em-events.php
 * add on line 162:
    global $stop_now;
 * then on line 198 make it like this:
    foreach ( $events as $EM_Event ) { if ( !
   $args[‘scope’] || ( $args[‘scope’] == $EM_Event->event_start_date ) ) { $output.
   = $EM_Event->output($format); $stop_now = false; } else { $output = get_option(‘
   dbem_no_events_message’ ); $stop_now = true; }
 * Then line 216 add the if statement around the output
 * if ( !$stop_now ) {
    $output = $format_header . $output . $format_footer; }
 * I know it’s a dirty hack but i’m too tired to make it nicer right now and just
   excited that it’s fixed.
 *  Thread Starter [gmorley](https://wordpress.org/support/users/gmorley/)
 * (@gmorley)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/plugin-events-manager-search-specific-date/#post-2971703)
 * Please note this is after using aglonwl’s suggestion to add $args[‘scope’] = 
   $_REQUEST[‘scope’][0]; inside if( get_option(‘dbem_events_page_search’) && !defined(‘
   DOING_AJAX’) ){ to the events-list.php
 * also note by altering a file in the classes directory, if you update the plugin
   you’ll have to go back and upload your changed file again. Be careful when doing
   this.. better to make the alterations to the new file if it was changed.

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

The topic ‘[Plugin: Events Manager] Search specific date’ is closed to new replies.

 * ![](https://ps.w.org/events-manager/assets/icon-256x256.png?rev=1039078)
 * [Events Manager - Calendar, Bookings, Tickets, 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/)

 * 7 replies
 * 2 participants
 * Last reply from: [gmorley](https://wordpress.org/support/users/gmorley/)
 * Last activity: [13 years, 8 months ago](https://wordpress.org/support/topic/plugin-events-manager-search-specific-date/#post-2971703)
 * Status: resolved