• Resolved wordpress1992

    (@adgardner13)


    I have created a custom scope for next 28 days and this works fine. But I would also like to create another scope for the next 56 days and I am unable to create this additional function without receiving 500 internal error, any tips?

    This is the existing function

    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']=='28days' ){
    		$start_date = date('Y-m-d',current_time('timestamp'));
    		$end_date = date('Y-m-d',strtotime("+28 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;
        
    }
    
    add_filter( 'em_get_scopes','my_em_scopes',1,1);
    function my_em_scopes($scopes){
    	$my_scopes = array(
    		'28days' => 'Next 28 Days'
    	);
    	return $scopes + $my_scopes;
    }
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom Scope’ is closed to new replies.