Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
facetwp translate labels
<?php
/** checks WPML current language if FWP()->facet->http_params['lang'] is not set
**/
add_filter( 'facetwp_i18n', function( $string ) {
if ( isset( FWP()->facet->http_params['lang'] ) ) {
$lang = FWP()->facet->http_params['lang'];
else {
$lang = apply_filters( 'wpml_current_language', null );
}
$translations = [];
$translations['es']['Products'] = 'Productos';
$translations['es']['Location'] = 'Ubicación';
if ( isset( $translations[ $lang ][ $string ] ) ) {
return $translations[ $lang ][ $string ];
}
return $string;
}, 11 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.