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

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • in 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]

Viewing 1 post (of 1 total)