Using Wordpress plugin Events Manager, my goal is to alter the search form so it searches for events on single dates. I don't want a date range search which is built in.

Most of my events are nightclub events, which carry on to the next day. Therefore, I also want to alter the event search so that if i search for say Saturday August 18th, I don't want it to display events that started on friday but ended on saturday at 3am.


I solved this. First add

$args['scope'] = $_REQUEST['scope'][0]; 

to the events-list.php under the line:


This will stop the search from finding a date range and only search single dates. Then in events-search.php, remove the second box for end-date.

then in events manager plugin folder "classes" file em-events.php

This is what it should look like from line 196. Please note, I got rid of the extra spaces between lines so my line 196 may not be the same as yours.. do a search for "if ( $events_count > 0 )" and that is the line I'll start from:

        if ( $events_count > 0 ) {

        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; // so that we don't add a header and footer if there are no events displayed          

        if ( !$stop_now ) { // if there are events to display
            //Add headers and footers to output
            if( $format == get_option ( 'dbem_event_list_item_format' ) ){
                $format_header = ( get_option( 'dbem_event_list_item_format_header') == '' ) ? '':get_option ( 'dbem_event_list_item_format_header' );
                $format_footer = ( get_option ( 'dbem_event_list_item_format_footer' ) == '' ) ? '':get_option ( 'dbem_event_list_item_format_footer' );
                $format_header = ( !empty($args['format_header']) ) ? $args['format_header']:'';
                $format_footer = ( !empty($args['format_footer']) ) ? $args['format_footer']:'';
            $output = $format_header .  $output . $format_footer;       
  • Do not forget to mark your answer as accepted then. – j0k Aug 23 '12 at 11:16

I discovered a setting that solves this problem without having to hack the code:

Events manager settings page -> Pages tab -> Event/List Archives

You'll find an option "Are current events past events?" set to yes. This will, for example, cause searches for sunday to not display events that started the saturday before.

Then just make the search form have a date input but not a date range input.. Seems to work great for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.