This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: ACF advanced custom Fields in results description

Home Forums Product Support Forums Ajax Search Pro for WordPress Support ACF advanced custom Fields in results description Reply To: ACF advanced custom Fields in results description

#17248
MarkChaskMarkChask
Participant

I wrote this. Maybe if you want to share it:

[code]add_filter( ‘asp_results’, ‘asp_custom_field_to_title’, 1, 1 );

function asp_custom_field_to_title( $results ) {
$custom_field = "super";

foreach ($results as $k=>$v) {

$meta_value = get_field(‘file_download’,$results[$k]->id); // ACF support

if($meta_value){
$results[$k]-&gt;title .= " – <a href=’" . $meta_value . "’ target=’_blank’>Download</a>";
}
else{
$results[$k]-&gt;title;
}
}

return $results;
}[/code]