Thanks for advise, but it not what I am looking for. In thread that you suggested me just description how to get all of events but I need exact event search result stored in variable.
yes, you can try something like this
$EM_Events = EM_Events::get($args);
foreach ( $EM_Events as $EM_Event ) {
echo $EM_Event->event_id;
}
– this will give you the events list in array and then use foreach to get the objects
The code, suggested bu tuo will give me all of events but I need search result. May be I describe my problem incorrect so lets look for example.
I have “Party” event. It happen every week in friday. I look for “Party” in Search and it show me 10 absolutely equal “Party” events with different date. I need only one future event to be shown. I dont need to have others events except “Party” because I haven’t search for them.
I shouldn’t to do additional request to database – search function already made it. I just need data.
hmm, is this for recurring events? where you’ve wanted to show only one recurring events in the event searches?
Yes, you understand me correct.
you can get this to work by modifying the $args array so it’s seomthing like:
$args = array(‘limit’=>1, ‘search’=>’Party’);
I think that’d return the soonest event by default, otherwise also add the order and orderby search attributes to the array. they’re the same as described here- http://wp-events-plugin.com/documentation/event-search-attributes/
Thanks Marcus, it is cool, but could I just get search result as array of events? Formatted output is not the thing that I need.
Solution to use next code doesn’t meet my goal.
$args = array('limit'=>1, 'search'=>'Party');
For example I have 3 recurring events. “Max Party”, “Alex Party”, “Dance party” and then I search for “Party” I should get all of listed events and result shouldn’t contain more then one instance of each recurrence.
Also I need search data to output some additional information.
Ok, I resolve it. I just get search args from %_POST variable and make a custom request without using plugin buildin search.
Thank for help.
Hi @raincoven
I try to resolve the same problem, it’s possible you explain more your approach and solution of this??
Thanks in advance
I resolve it with next steps:
1) I get search filter args from $_POST variable like this:
$args = array();
foreach ($_POST as $key=>$val) {
if (!empty($val) && !empty($key)) {
$args[$key] = $val;
}
}
$events_obj = EM_Events::get($args);
Keep in mind that default search form send to $_POST variable different array keys from used in EM_Events::get() function, so i made my custom form.
2) So then I get all of events with applied search filter I just took all that i need with my custom function. $events = get_unique_events($events_obj);
This is not the best decision but it work and plugin code shouldn’t be modified.