• Cars10

    (@shonu)


    Using Plugin 4.304 still (not the time to do this big step to posts, yet)

    I want to hide an event (temporarily) to avoid that I have to retype all the crap again when deciding to put it up again.

    Besides putting an old date, is there a simple way out like a custom attribute that then easily removes all the events with that flag set from all event queries ?

    I want to avoid the need to add stuff to my own plugin to achieve this if possible.

    thanks

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

Viewing 1 replies (of 1 total)
  • you can create a similar search attribute like these:

    add_filter('em_events_get_default_search','my_em_hide_event',1,2);
    function my_em_hide_event($searches, $array){
    	if( !empty($array['hide_event']) ){
    		$searches['hide_event'] = $array['hide_event'];
    	}
    	return $searches;
    }
    
    add_filter('em_events_get','my_em_hide_event_get',1,2);
    function my_em_hide_event_get($events, $args){
    	if( !empty($args['hide_event']) ){
    		foreach($events as $event_key => $EM_Event){
    			if( in_array($args['hide_event'],$EM_Event->event_attributes) ){
    				unset($events[$event_key]);
    			}
    		}
    	}
    	return $events;
    }

    Modify and copy to your theme functions.php

    Sample usage: [events_list hide_event=1]

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Events Manager] Hiding an Event’ is closed to new replies.