Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter debsch

    (@debsch)

    Aha! (I gave up too soon)

    https://wp-events-plugin.com/documentation/event-search-attributes/

    Accepted Arguments : future, past, today, tomorrow, month, next-month, 1-months, 2-months, 3-months, 6-months, 12-months, all

    But no week or fortnight….
    I might be posting a question about that if I can’t figure out the ‘create your own scope’ tutorial.

    Thread Starter debsch

    (@debsch)

    Great tutorial!

    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']=='nextfortnight' ){
    		$start_date = date('Y-m-d',current_time('timestamp'));
    		$end_date = date('Y-m-d',strtotime("+14 days", 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;
    }

    Then I change 'scope'=>'future' to 'scope'=>'nextfortnight'
    and it shows the events for the next fortnight.
    Fabulous!
    ??

    Where did you add your own filter, Debsch? Looks exactly like what I’m looking for. Thanks in advance.

    you can add that in your theme functions e.g. functions.php

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Events Manager] What other options are there for SCOPE besides future?’ is closed to new replies.