September 10, 2015 at 10:28 am
#5847
Ernest Marcinko
Keymaster
You are welcome!
Indeed, I made a syntax error there.
For future reference the correct code:
[php]
add_filter( ‘asp_results’, ‘asp_checkbox_to_results’, 1, 1 );
function 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;
}
[/php]