djrmom

{{gist file=”custom-hooks.php” lang=”php”}}
<?php

/* convert state into region */
add_filter( ‘facetwp_index_row’, function( $params, $class ) {
if ( ‘region’ == $params[‘facet_name’] ) {
$northwest = array( ‘WA’, ‘OR’, ‘MT’);
$northeast = array( ‘ME’, ‘VT’, ‘MA’, ‘NH’ );
$raw_value = $params[‘facet_value’];

if ( in_array( $raw_value, $northwest ) ) {
$params[‘facet_value’] = ‘northwest’;
$params[‘facet_display_value’] = ‘North West’;
} elseif ( in_array( $raw_value, $northeast ) ) {
$params[‘facet_value’] = ‘northeast’;
$params[‘facet_display_value’] = ‘North East’;
}
}
return $params;
}, 10, 2 );
{{/gist}}