Index whether field value is empty or not

mgibbs189

{{gist file=”functions.php” lang=”php”}}
<?php

// Replace “CHANGE_ME” with the actual facet _name_

add_filter( ‘facetwp_index_row’, function( $params, $class ) {
if ( ‘CHANGE_ME’ == $params[‘facet_name’] ) {
if ( ” != $params[‘facet_value’] ) {
$params[‘facet_value’] = ‘yes’;
$params[‘facet_display_value’] = ‘Yes’;
}
else {
$params[‘facet_value’] = ‘no’;
$params[‘facet_display_value’] = ‘No’;
}
}
return $params;
}, 10, 2 );
{{/gist}}