Home › Forums › Support › Bug Elements and Display Rules and WPML /WPML global locations bug ongoing
- This topic has 13 replies, 2 voices, and was last updated 1 year, 11 months ago by
Tom.
-
AuthorPosts
-
August 28, 2018 at 12:26 pm #662583
Martin U
Hi Guys,
there is unfortunately a major bug in the display rules of elements when working with WPML
1.
If I assign “Front Page” to an element the English Version of the element gets displayed on the English and German version of the home page.If I assign the translated German version to “Front Page” as well the English and the German version get displayed both in the English and in the German version.
This basically means Elements and as such GPP is not compatible with WPML. Please fix this or offer workaround.
2.
BTW assigning an element to the home page via page name does not work at all. I feel is another bug.There either needs to be a “Front page” “Blog” per language version or GPP needs to be able to get the right language version.
3.
The old page headers btw still not work with WPML and global locations. that hasn’t been fixedGeneratePress 2.1.4GP Premium 1.7.2August 28, 2018 at 3:55 pm #662746Tom
Lead DeveloperLead DeveloperHi there,
1. We can try using a filter like this as a workaround:
add_filter( 'generate_header_element_display', function( $display, $element_id ) { if ( is_front_page() ) { // Target our German Header Element with the ID: 10 if ( 10 === $element_id ) { if ( 'de_DE' === get_locale() ) { return true; } else { return false; } } // Target our English Header Element with the ID: 20 if ( 20 === $element_id ) { if ( 'de_DE' !== get_locale() ) { return true; } else { return false; } } } return $display; }, 10, 2 );
So the above targets our front page and will display the Header with the ID
10
when German is set, and20
when it’s not set.Note that I don’t know if
get_locale()
is compatible with WPML. They might have a function you need to use instead of it.2. This is a known issue we’re looking into.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentAugust 28, 2018 at 11:35 pm #662942Martin U
Thank you for the fast reply, Tom.
I managed to use a workaround with conditional WPML language short codes.
The solution is documented here, in case anybody else comes across the same problem.
https://generatepress.com/forums/topic/wpml-page-header-global-locations/
Another thing I noticed, which I feel is a bug in the “display rules”
If I’m selecting specific pages for an English language element to be displayed, I get offered both pages. The page in English and in German language.
The way it should work – in my understanding and compared to similar plugins:
English element –> only English pages in the display rules
German element –> only German pages in the display rules.I sincerely hope that the display rules get fixed to work flawlessly with WPML. WPML is pretty much the industry standard for multilingual WordPress sites.
If you need something tested, please let me know. We have a universal unlimited WPML license.
best Martin
August 29, 2018 at 9:19 am #663483Tom
Lead DeveloperLead DeveloperThank you! We’ll take a closer look at WPML and will try to make it perfectly compatible.
Really appreciate your feedback 🙂
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentAugust 30, 2018 at 3:42 am #664125Martin U
You are very welcome. Please let me, if I can help.
September 2, 2018 at 8:49 am #666723Tom
Lead DeveloperLead DeveloperWPML provided this function to another member: https://gist.github.com/srdjan-jcc/00ee8d15afb3c6c1497af5ff92d32a8e
Perhaps it will help?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentSeptember 2, 2018 at 2:23 pm #666905Martin U
Thank you, I will give it a try
September 2, 2018 at 7:47 pm #666980Tom
Lead DeveloperLead DeveloperJust a note that the above will only work for the Hook element type.
To make it work with Headers, you’d replace this:
generate_hook_element_display
With this:
generate_header_element_display
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentSeptember 7, 2018 at 11:59 pm #671680Martin U
Thanks Tom, I have tested the hook version and it did well with display rules like “Site” or “Frontpage”
September 8, 2018 at 8:54 am #671952Tom
Lead DeveloperLead DeveloperAwesome 🙂
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentApril 9, 2019 at 2:43 am #863672Martin U
Just a note that the above will only work for the Hook element type.
To make it work with Headers, you’d replace this:
generate_hook_element_display
With this:
generate_header_element_display
If anybody reads this, just tested that today. This actually works.
April 9, 2019 at 8:48 am #864177Tom
Lead DeveloperLead DeveloperGPP 1.8.0 has support for WPML now, so you don’t need to use the filter method: https://generatepress.com/gp-premium-1-8/
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentApril 10, 2019 at 10:40 am #865319Martin U
great news, Tom!
even better news: it actually works. Tested a header element on the frontpage worked out of the box under 1.8.
Thank you so much.
April 10, 2019 at 4:20 pm #865500Tom
Lead DeveloperLead DeveloperAwesome! Thanks for testing!
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-development -
AuthorPosts
- You must be logged in to reply to this topic.