Events Manager
[resolved] What other options are there for SCOPE besides future? (5 posts)

  1. debsch
    Posted 4 years ago #

    Hello - a QUICK question I hope.

    There's 'scope'=>'future'
    but what else?

    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!


  2. debsch
    Posted 4 years ago #

    Aha! (I gave up too soon)


    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.

  3. debsch
    Posted 4 years ago #

    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.

  4. eliasen
    Posted 4 years ago #

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

  5. agelonwl
    Posted 4 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Events Manager
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic