Reply To: Search by dates

Ernest Marcinko
Ernest Marcinko


Thank you very much, I’m doing great, I hope you too!

I’m guessing you want to display the event date as part of the result description. I’ve put together the following code to display the date before description. Put it into your active theme folder, into the functions.php file:

add_filter('asp_pagepost_results', 'asp_em_dates', 1, 1); 
function asp_em_dates( $results ) {
  foreach ($results as $k => $r) {
    if ( $r->post_type != "event" ) continue;
    $event = EM_Events::get($r->id);
    $start = date(get_option( 'date_format' ), $event[0]->start);
    $end =  date(get_option( 'date_format' ), $event[0]->end);
    $results[$k]->content = $start . " - " .$end . "<br>" . $results[$k]->content;
  return $results;

Hopefully this will help.

Ernest Marcinko

If you like my products, don't forget to rate them on codecanyon :)