WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
Hiding an Event (2 posts)

  1. Shonu
    Member
    Posted 2 years ago #

    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

    http://wordpress.org/extend/plugins/events-manager/

  2. agelonwl
    Member
    Posted 2 years ago #

    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]

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic