Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Can I display published date and last update in search result? › Reply To: Can I display published date and last update in search result?
April 10, 2019 at 9:12 am
#22095
Keymaster
Hi,
Sure, this is only possible via using a custom code. Try this custom code in the functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case!
add_filter('asp_results', 'asl_modified_date', 10, 1);
function asp_modified_date($results) {
foreach ($results as $k=>&$r) {
$dates =
'Published: ' . get_the_date('', $r->id) . '<br>' .
'Modified: ' . get_the_modified_date('', $r->id) . '<br>';
$r->content = $dates . $r->content;
}
return $results;
}