Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
Client is trying to add a language switcher to their website's menu but ends up with a lot of code displayed instead of the flag image and language name.

Solution:
If you're experiencing an issue where your language switcher displays code instead of the correct flag and language name, it might be due to a custom navigation menu implementation from your theme. We recommend you follow these steps:

1. Make sure to back up your entire website.
2. Navigate to Appearance > Theme File Editor and select the

inc\wp_bootstrap_navwalker.php

file.
3. Find line 250 and replace it with the following code:

$title = apply_filters( 'the_title', $item->title, $item->ID );

4. Save the changes and check if the issue is resolved.

Please note that this solution might be outdated or not applicable to your case. If the issue persists, we highly recommend checking related known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If you still need assistance, please do not hesitate to open a new support ticket in the WPML support forum.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: 

This topic contains 5 replies, has 2 voices.

Last updated by Lucas Vidal de Andrade 9 months ago.

Assisted by: Lucas Vidal de Andrade.

Author Posts
March 18, 2024 at 11:57 am #15420705

magdalenaW-5

Tell us what you are trying to do?
Add a language switcher on the clients website. I wanted to add a menu language switcher and chose ‘Menu PL’ as a position and what I’m ending with is a menu which works properly but there’s a lot of code instead of an image of a flag and language name.

Is there any documentation that you are following?
-

Is there a similar example that we can see?
screenshot (I'm using default settings when I'm adding this menu (WPML\Languages\Menu language switcher)).

What is the link to your site?
hidden link - I can share login/pass in a more safe way than pasting it here.

Can you verify where's the problem? Is it custom menu which client created (if yes how can we correct it?).

Best regards
Paweł Uliczny

menu.png
March 18, 2024 at 1:20 pm #15421232

Lucas Vidal de Andrade
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello,

Thank you for contacting WPML Support, I will be happy to help you.


1) It seems this might be a theme issue. WPML Language switcher takes formatting from the current theme to make the language switcher style consistent to the current theme menu.

- Could you try to disable flag images and see if the language text shows correctly?
You may disable it from WPML >> Languages > Menu language switcher and click on the pen icon to edit the language switcher and uncheck the “Flag” checkbox and press the “Save” button.

2) Would it be possible to check if the issue happens if you switch to a default WP theme?

After, check if the issue is still happening.

Note: Please make sure you have a full backup (files & database) before trying anything on your website.

March 18, 2024 at 2:17 pm #15421606

magdalenaW-5

Hello Lucas,
1) I've disabled the flag (screen "custom_theme.png") - there's just less code
2) changing the default theme didn't help (checked all themes [2022/2023/2024]) - screenshot2.

Backup created.
I can share credentials if that helps.

Best regards
Paweł Uliczny

twenty one_two_three.png
custom_theme.png
March 18, 2024 at 3:29 pm #15422290

Lucas Vidal de Andrade
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Thank you for sharing 🙂

I would like to request temporary access (wp-admin and FTP) to your site to take a better look at the issue. It would be better to a testing site where the issue is replicated.

You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.

Maybe I'll need to replicate your site locally. For this, I’ll need to temporarily install a plugin called “Duplicator” or "All in One WP Migration" on your site. This will allow me to create a copy of your site and your content. Once the problem is resolved I will delete the local site. Let me know if this is ok with you.

IMPORTANT

- Please make a backup of site files and database before providing us access.
- If you do not see the wp-admin/FTP fields this means your post & website login details will be made PUBLIC. DO NOT post your website details unless you see the required wp-admin/FTP fields. If you do not, please ask me to enable the private box. The private box looks like this:

hidden link

March 19, 2024 at 7:18 pm #15428547

Lucas Vidal de Andrade
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello,

Regarding the Language Switcher in the Menu, I could indeed reproduce the issue locally, in a copy of your website (I had to install All In One WP Migration, as Duplicator did not work). Even deactivating all plugins and changing themes didn't solve the issue.

I sent your ticket to our development team, which will take a deeper look at your code, to find a cause and a solution. That can take a few days, thank you for your patience. As soon as I have feedback from them, I'll let you know.

Regarding the footer, I opened a new ticket. This way, we can ensure that both problems will be resolved 🙂
https://wpml.org/forums/topic/split-footer-language-switcher/#post-15428374

March 21, 2024 at 4:42 pm #15437609

Lucas Vidal de Andrade
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello,

I got feedback from our developers. It appears that the issue was being caused by a custom navigation menu implementation from your theme. Please try these steps and let me know how it goes:

1. Make a full backup of your website;
2. Go to Appearance > Theme File Editor and select the inc\wp_bootstrap_navwalker.php file;
3. Replace line 250 with the following line:

$title = apply_filters( 'the_title', $item->title, $item->ID );

4. Save your changes

Please let me know if that solves your issue.

01.jpeg
March 22, 2024 at 10:03 am #15439669

magdalenaW-5

Hello Lucas,
thank you very much for the help 🙂
That solved my problem!

Best regards
Paweł Uliczny