Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

EDITED MY QUESTION TO MAKE IT WAY MORE CONCISE

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.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

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.

share|improve this answer

I solved this. First add

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

to the events-list.php under the line:

 em_locate_template('templates/events-search.php',true);

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' );
            }else{
                $format_header = ( !empty($args['format_header']) ) ? $args['format_header']:'';
                $format_footer = ( !empty($args['format_footer']) ) ? $args['format_footer']:'';
            }   
            $output = $format_header .  $output . $format_footer;       
        }
share|improve this answer
    
Do not forget to mark your answer as accepted then. –  j0k Aug 23 '12 at 11:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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