Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter sakyastelios

    (@sakyastelios)

    I write the next code, but I’m not sure where can I put it. I added it to the bottom of events-manager/buddypress/bm-em-groups.php only for testing.

    function bp_em_sakya_events_build_sql_conditions( $conditions, $args ){
    
    	if( !empty($args['skperiodo']) && is_numeric($args['skperiodo']) ){
    		$conditions['skperiodo'] = "( DATEDIFF( event_end_date , event_start_date ) = $args['skperiodo'] )";
    	}
    
    	return $conditions;
    }
    add_filter('em_events_build_sql_conditions','bp_em_sakya_events_build_sql_conditions',1,2);
    
    function bp_em_sakya_events_accepted_searches($searches){
    		$searches[] = 'skperiodo';
    	return $searches;
    }
    add_filter('em_accepted_searches','bp_em_sakya_events_accepted_searches',1,1);
    
    function bp_em_sakya_events_get_default_search($searches, $array){
    	if( !empty($array['skperiodo']) && is_numeric($array['skperiodo']) ){
    
    			$searches['skperiodo'] = $array['skperiodo'];
    	}
    	return $searches;
    }
    add_filter('em_events_get_default_search','bp_em_sakya_events_get_default_search',1,2);

    Filters than run functions need to be added to the functions.php file of your theme.

    This might help:
    https://wp-events-plugin.com/tutorials/create-your-own-event-scope/

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Create a new search atribute for display events in location map’ is closed to new replies.