FacetWP integration
-
Hi! I’m trying to write a small plugin to make FacetWP’s facets translatable using TranslatePress. I’ve been instructed by their support team to do (at the minimum) this:
add_action( 'wp_footer', function() { $lang = some_translate_function_to_get_current_language(); // <--- HTTP || {}; FWP_HTTP.lang = '$lang';</script>"; }, 30 ); // maybe needed depending on how translate press works add_filter( 'facetwp_query_args', function facetwp_query_args( $args ) { $http = FWP()->facet->http_params; if ( isset( $http['lang'] ) && $http['lang'] !== $this->default_language ) { // whatever translatepress needs to switch to current language in query } return $args; } );
So, I need to figure out:
- How do I programmatically get the default language? Through a new TRP_SETTINGS object and then $settings[‘default-language’]?
- How do I programmatically get the current language? global $TRP_LANGUAGE?
- How do I programmatically have TranslatePress switch to the current language, like WPML does with do_action( ‘wpml_switch_language’, $language_code )? Do I even need to?
Cheers,
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘FacetWP integration’ is closed to new replies.