Reply To: Checklist Field Displays as Array

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Checklist Field Displays as Array Reply To: Checklist Field Displays as Array

#5694
Ernest Marcinko
Ernest Marcinko
Keymaster

Hi!

If the normal description is showing, then the “if ( $checkboxes ) …” part of the code is not executed. I think the ACF get_field() function needs a post ID as well. Try this modification of their suggestion:


add_filter( 'asp_results', 'asp_checkbox_to_results', 1, 1 );

asp_checkbox_to_results( $results ) {
  foreach ($results as $k=>$v) {
    // Get the field
    $checkboxes = get_field('my_checkbox_list', $v->id);
    // Append if exists
    if( $checkboxes ){  
        $checkbox_string = implode(', ', $checkboxes);
        $results[$k]->content  .= " – " . $checkbox_string;
    }
  }
  
  return $results;
}
  • This reply was modified 8 years, 8 months ago by Ernest Marcinko Ernest Marcinko. Reason: fix
Best,
Ernest Marcinko

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