• Resolved onawhim

    (@onawhim)


    Created a custom scope called Current Events intended to show yesterday and future events. The scope shows but it returns all events. I put the code in functions.php in the root of TwentyTen, my current theme.

    add_filter( ’em_events_build_sql_conditions’, ‘current_events_conditions’,1,2);

    function current_events_conditions($conditions, $args){
    if( !empty($args[‘scope’]) && $args[‘scope’]==’current-events’ ){
    $yesterday = date(‘Y-m-d’,strtotime(“-1 day”, current_time(‘timestamp’)));
    $conditions[‘scope’] = ” (event_start_date >= CAST(‘$yesterday’ AS DATE)”;
    }
    return $conditions;
    }
    add_filter( ’em_get_scopes’,’current_events_scopes’,1,1);
    function current_events_scopes($scopes){
    $my_scopes = array(
    ‘current-events’ => ‘Current Events’
    );
    return $scopes + $my_scopes;
    }

    https://www.ads-software.com/plugins/events-manager/

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom Scope Returns Wrong Set’ is closed to new replies.