Title: custom scope
Last modified: January 19, 2020

---

# custom scope

 *  Resolved [Powerful1](https://wordpress.org/support/users/powerful1/)
 * (@powerful1)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/custom-scope-3/)
 * I am making a mobile view for my calendar page. It will display an agenda.
 * I want to display the events using three scopes: today, tomorrow, day-after-tomorrow.
 * day-after-tomorrow needs to be a custom scope. I used the code below. Notice 
   the way I structured the start and end dates:
    **$start_date = date(‘Y-m-d’,current_time(“
   +2 day”, current_time(‘timestamp’)); $end_date = date(‘Y-m-d’,strtotime(“+50 
   day”, current_time(‘timestamp’)));
 * The output showed results beginning Feb 6 (it is Jan 18) and then random events
   6 months out. What do I need to do to fix this?
 *     ```
       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']=='day-after-tomorrow' ){
               $start_date = date('Y-m-d',current_time("+2 day", current_time('timestamp'));
               $end_date = date('Y-m-d',strtotime("+50 day", 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;
       }
   
       $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))";
   
       add_filter( 'em_get_scopes','my_em_scopes',1,1);
       function my_em_scopes($scopes){
           $my_scopes = array(
               'day-after-tomorrow' => 'Day After Tomorrow'
           );
           return $scopes + $my_scopes;
       }
       ```
   
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fcustom-scope-3%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Thread Starter [Powerful1](https://wordpress.org/support/users/powerful1/)
 * (@powerful1)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/custom-scope-3/#post-12340628)
 * wrong url…use this
 * [https://meditateinolympia.org/calendar-test/](https://meditateinolympia.org/calendar-test/)
 *  Plugin Support [angelo_nwl](https://wordpress.org/support/users/angelo_nwl/)
 * (@angelo_nwl)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/custom-scope-3/#post-12351490)
 * just to confirm, did you mean the (events) date tomorrow until let us say to 
   1 year? thanks
    -  This reply was modified 6 years, 4 months ago by [angelo_nwl](https://wordpress.org/support/users/angelo_nwl/).
 *  Thread Starter [Powerful1](https://wordpress.org/support/users/powerful1/)
 * (@powerful1)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/custom-scope-3/#post-12353886)
 * Hi Angelo_nwl
 * I am looking to have the event date as tomorrow +1.
 * For example, if today (startdate) is Wednesday, I would like the custom scope
   to display Friday onwards.
 *  [timrv](https://wordpress.org/support/users/timrv/)
 * (@timrv)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/custom-scope-3/#post-12355163)
 * Hello,
 * if you want to get the current date + 1 day, You could try doing something like:
 * `$tomorrow = date("Y-m-d", time() + 86400);` or `$tomorrow = strtotime('tomorrow');`
   or `date('Y-m-d', strtotime($date. ' + 2 days'));`

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

The topic ‘custom scope’ is closed to new replies.

 * ![](https://ps.w.org/events-manager/assets/icon-256x256.png?rev=3550347)
 * [Events Manager - Calendar, Bookings, Tickets, and more!](https://wordpress.org/plugins/events-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/events-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/events-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/events-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/events-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/events-manager/reviews/)

 * 4 replies
 * 3 participants
 * Last reply from: [timrv](https://wordpress.org/support/users/timrv/)
 * Last activity: [6 years, 4 months ago](https://wordpress.org/support/topic/custom-scope-3/#post-12355163)
 * Status: resolved