Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Search by dates › Reply To: Search by dates
Hi!
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:
[php]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;
} [/php]
Hopefully this will help.