<?php
/** 'author' is the Unique name set in the Listing Builder item's settings.
** Loop over the array returned from ACF to build an HTML string from the subfields and return it to the Listing Builder's
** facetwp_builder_item_value filter
**/
add_filter( 'facetwp_builder_item_value', function( $value, $item ) {
if ( 'author' == $item['settings']['name'] ) {
$value = '';
$authors = get_field( 'author' );
if ( !empty( $authors ) ) {
foreach ( $authors AS $author ) {
$value .= $author['title'] . ' ' . $author['name'] . '<br />'; // create an html string formatted as needed to return
}
}
}
return $value;
}, 10, 2 );