Skip to content

Instantly share code, notes, and snippets.

@mgibbs189
Created November 1, 2019 13:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mgibbs189/cc656b2a0129a79135307a52ff46b0eb to your computer and use it in GitHub Desktop.
Save mgibbs189/cc656b2a0129a79135307a52ff46b0eb to your computer and use it in GitHub Desktop.
FacetWP - get county name from code
<?php
// Add the following to your (child) theme's functions.php file
// Then re-index afterwards
add_filter( 'facetwp_index_row', function( $params, $class ) {
if ( 'country' == $params['facet_name'] && 2 == strlen( $params['facet_value'] ) ) {
$params['facet_display_value'] = locale_get_display_region( '-' . $params['facet_value'], 'en' );
}
return $params;
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment