Resolved
Reported for: WPML Multilingual CMS 4.5.12
Resolved in: 4.6.0
Overview of the issue
If you are using the horizontal list or vertical list display options for any of the language switchers on your site, the order is not consistent when you switch languages on the front-end. Instead, the current language will always be displayed in first position, despite your settings.
Workaround
Please, be sure of making a full backup of your website.
- Open the /sitepress-multilingual-cms/classes/language-switcher/class-wpml-ls-model-build.php file.
- Look for line 244.
- Replace:
$ret = $this->order_menu_items( $ret, $this->sitepress->get_current_language() );
With:
if (! $slot->get( 'display_link_for_current_lang' )) { $ret = $this->order_menu_items( $ret, $this->sitepress->get_current_language() ); }
Thank you for the tip. It works super.
Evelyne
I’m glad to know that it worked, Evelyne.
It should be fix in a future release, we will keep this errata updated.
Cheers!
V 4.5.13 should fix the bug, bot on our site it is not fixed and we have updated to v4.5.13
The site: https://hms-ag.com/
Hello there,
We haven’t released a new release including a fix yet. Could you please follow the workaround here presented in the meantime?
Regards
Thank you Andres for your fast reply but isnt it the bug you mentioned in the release notes? https://wpml.org/version/wpml-4-5-13/
I see your point, but it is not precisely the same issue.
We will update this erratum as soon as a new release include this fix.
Thank you for your understanding.
Still not fixed in Version 4.5.14 – but the manual fix is working
I’m glad to know the workaround still works. We will update here once we launch a new version fixing this issue.
Regards
fyi: Fix didn’t work on our site.
WPML: Version 4.5.14
php 8.2
Site crashed, error-message:
Parse error: syntax error, unexpected variable “$ret” in (…)/wp-content/plugins/sitepress-multilingual-cms/classes/language-switcher/class-wpml-ls-model-build.php on line 245
Hello Holger,
I’m unable to reproduce this error. Could you please open a chat in our support forum so we can investigate it better?
Thank you for your help