Skip Navigation

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

Problem:
You are developing a site and want to add an icon as the first item in the language switcher menu using WPML, but could not find documentation related to this.
Solution:
We recommend creating your own language switcher using PHP to customize the flag image or add an icon. You can find detailed guidance on how to do this in our documentation:

Please note that implementing a custom icon might require specific coding, which is beyond the scope of our support forum. If the provided documentation does not fully resolve your issue or if it seems outdated or irrelevant to your specific case, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If further assistance is needed, please open a new support ticket at 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.

This topic contains 3 replies, has 2 voices.

Last updated by Lucas Vidal de Andrade 4 months ago.

Assisted by: Lucas Vidal de Andrade.

Author Posts
July 25, 2024 at 1:44 pm #16003845

giladC

Background of the issue:
I am developing a site and want to have an icon as the first item in the language switcher menu using WPML.

Symptoms:
Could not find documents related to adding an icon to the language switcher menu.

Questions:
How can I add an icon as the first item in the language switcher menu?

July 26, 2024 at 5:37 pm #16009516

Lucas Vidal de Andrade
Supporter

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

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

Hey there,

Thank you for reaching out to us and for your patience. WPML offers the option of creating your own language switcher using PHP, and to change the flag image as you wish. It's described here:

https://wpml.org/documentation/getting-started-guide/language-setup/language-switcher-options/custom-language-switcher/

https://wpml.org/documentation/getting-started-guide/language-setup/language-switcher-options/

https://wpml.org/documentation/getting-started-guide/language-setup/language-switcher-options/adding-language-switchers-using-php-and-shortcodes/

Based on your description, it's very likely that this can only be done with code. We cannot give you the precise code needed to implement the icon specifically, that would be outside the scope of this Forum. I hope the documentation is helpful. Let me know if that answers your question.

July 29, 2024 at 8:54 am #16014658

giladC

Hi,
I understand this is issue is not in your scoope.
I need to figour how to do it..
Becouse the like you provide dont give the exact answer

Is there a link that I can use in the WP menu for each lang ?

July 29, 2024 at 4:29 pm #16017257

Lucas Vidal de Andrade
Supporter

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

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

Hey there. Thank you for understanding.

Every page has its own URL, for each language. One simple option is to link to the home page inside a custom-created language switcher.

For example, if your website is English by default and has Spanish and German as secondary languages, you could insert in your menu (using your desired design) the two URLs for the initial pages in the other languages:

my-website.com/de
my-website.com/es

That's just a simple example of what can be done without using the custom PHP code provided by WPML. Of course that's more limited and can vary depending on how your website is configured.