Support » Plugin: Events Manager » [Plugin: Events Manager] What other options are there for SCOPE besides future?

  • Resolved debsch

    (@debsch)


    Hello – a QUICK question I hope.

    There’s 'scope'=>'future'
    but what else?
    Today/tomorrow/next_week/next-week/nextweek??

    I can’t find a list anywhere.
    (Have tried a search on the EM website and just come up with create your OWN scope – I just want to know what’s there already)

    Thank you!

    http://wordpress.org/extend/plugins/events-manager/

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

    (@debsch)

    Aha! (I gave up too soon)

    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.

    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.