Fix EA Post Grid | Polylang: translate saved templates & pin Post Grid query language#825
Open
ZebaAfiaShama wants to merge 1 commit into
Conversation
Saved templates embedded in EA widgets (Advanced Tabs, Advanced Accordion, Info Box, Flip Box, CTA Box, Countdown, Data Table) always rendered the source-language template on Polylang sites, and Post Grids could show posts from the wrong language. Root causes: - Template translation used post type 'wp_template'; EA saved templates are 'elementor_library', so the wpml_object_id lookup never matched and returned the original id unchanged. - Polylang ships no Elementor integration, so elementor_library is not a translatable post type and the central documents/get/post_id translation filter was disabled (gated to WPML only). - Post Grid query had no language pinning, so it followed the ambient (cookie / last-page-load) language instead of the page's own language. Fixes: - Correct post type 'wp_template' -> 'elementor_library' in all saved-template wpml_object_id calls. - Make eael_wpml_template_translation() Polylang-native via pll_get_post(), and re-enable the elementor/documents/get/post_id filter for Polylang. - Register elementor_library as translatable via pll_get_post_types. - Pin the Post Grid query to the page/document language (new Helper::eael_get_current_language()), with an eael/post_grid/query_lang filter. - Add a language suffix to Post Grid transient cache keys to avoid collisions between translated pages that share a widget id. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Saved templates embedded in EA widgets (Advanced Tabs, Advanced Accordion, Info Box, Flip Box, CTA Box, Countdown, Data Table) always rendered the source-language template on Polylang sites, and Post Grids could show posts from the wrong language.
Root causes:
Fixes: