• Resolved nunomira

    (@nunomira)


    Hi,

    On this page the calendar is being displayed.
    There is this event “Bichos” that started on the 6th of April and is running til the 31st of July.
    How can show it with starting with today’s date only (instead the 6th of April)?

    Moreover, I’m supposed to use
    long_events = 1
    Which means that now, in my dev environment, I have dozens of days, with the same events showing. It starts on the 6th, and then comes the 7th, the 8th, … of April! Which doesn’t make sense.

    How to solve this?
    Thanks

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support angelo_nwl

    (@angelo_nwl)

    Hi,

    just to confirm, can I know which shortcode are you using? It looks like you already customized the events_calendar or you are using events_list shortcode?

    Thread Starter nunomira

    (@nunomira)

    hi @angelo_nwl,

    Here’s the code:

    
    $query_args = array(
        'mode' => 'daily',
        'long_events' => true,
        'header_format' => $separator1 . $separator2,
        'date_format' => 'j F Y',
        'format_header' => '',
        'format' => $card_event . $separator3,
        'format_footer' => '',
        'scope' => 'date-future',
        'tag' => -914,
        'limit' => 0,
    );
    em_events_list_grouped($query_args);
    

    And for date-future I have:

    function my_em_scope_conditions($conditions, $args){
        if(!empty($args['scope']) && $args['scope'] == 'date-future'){
            if(isset($_REQUEST['calendar_day']))
                $calendar_date = $_REQUEST['calendar_day'];
            else
                $calendar_date = date('Y-m-d'); 
    
            $conditions['scope'] = " (event_start_date >= CAST('$calendar_date' AS DATE) OR event_end_date >= CAST('$calendar_date' AS DATE))";
        }
        return $conditions;
    }
    add_filter('em_events_build_sql_conditions', 'my_em_scope_conditions', 1, 2);
    
    function my_em_scopes($scopes){
        $my_scopes = array(
            'date-future' => 'Future from date'
        );
        return $scopes + $my_scopes;
    }
    add_filter('em_get_scopes','my_em_scopes', 1, 1);

    Thanks

    Plugin Support angelo_nwl

    (@angelo_nwl)

    I think its because this event dated 6Abr–31Jul https://happykids.pt/evento/bichos/ – you can try to set long_events=0 or or under events > settings > pages > event list/archives > are current events past events

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘show events only for today and future’ is closed to new replies.