• Hi,

    events_list displays events with a default range of future. This means that it won’t show events that have just happened for the rest of that day which I would like if possible?

    So it would display all events from today and the future.

    Thanks,

    Jon

Viewing 4 replies - 1 through 4 (of 4 total)
  • Here’s a tutorial on creating your own custom event scope: https://wp-events-plugin.com/documentation/tutorials/create-your-own-event-scope/

    There’s an easier way. Go to Events Manager settings then select the Pages tab then click on the Event List/Archives section then under “General settings” in that section set the following option to Yes:

    Are current events past events?Yes     No 
    By default, events that have an end date later than today will be included in searches, set this to yes to consider events that started ‘yesterday’ as past.

    Thread Starter jonchall

    (@jonchall)

    Thanks for this but I’m not sure this does what I need.

    I have events at 6, 7 and 9.30am and 5, 6 and 7pm each day.

    I want all of them to display all day but, when I select that option, then 6am event disappears at soon as it starts at 6am instead of at it’s end time.

    Unless I’m doing something wrong?

    Thanks for your help,

    Jon

    • This reply was modified 4 months, 2 weeks ago by jonchall.

    You’re correct. I didn’t read the description of the “Are current events past events?” option. It indeed doesn’t do what you want.

    You can create your own scope using the following code snippet:

    add_filter( 'em_events_build_sql_conditions', 'my_em_scope_conditions',1,2);
    function my_em_scope_conditions($conditions, $args) {
    if (!empty($args['scope'])) {
    $set_scope = false;
    if( $args['scope'] == 'future-plus-today' ) {
    $tz = new DateTimeZone(wp_timezone_string());
    $start_date = wp_date("Y-m-d", null, $tz) . " 00:00:01";
    $conditions['scope'] = " (event_start_date >= CAST('$start_date' AS DATE) )";
    }
    }
    return $conditions;
    }
    add_filter( 'em_get_scopes','my_em_scopes',10,2);
    function my_em_scopes($scopes){
    $my_scopes = array( 'future-plus-today' => 'Future plus today' );
    return $scopes + $my_scopes;
    }

    Then you could use the following shortcode:

    [events_list scope="future-plus-today"]
Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.