Skip Navigation

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

Problem:
The client is using a dropdown in the language switcher and wants to display a custom image icon, not a flag, before the current language.
Solution:
To replace the flag with a custom image icon in the language switcher, you need to create a custom language switcher. We recommend checking our documentation on creating a custom language switcher at Custom Language Switcher. Additionally, you can find useful examples in our support forums:

As a simpler workaround, consider changing the default language flags in WPML by navigating to WPML>>Languages>>Site Languages>>Edit Languages. For more details, refer to Editing WPML's Languages Table and Adding custom language.

If this solution does not apply to your case, or if it seems outdated, 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 you still need assistance, please open a new support ticket.

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 1 reply, has 2 voices.

Last updated by Bigul 11 months, 2 weeks ago.

Assisted by: Bigul.

Author Posts
June 30, 2024 at 3:49 am #15860374

安 漢成

Background of the issue:
I am developing a site and using a dropdown in the language switcher. I want to display a custom image icon, not a flag, before the current language.

Symptoms:
None

Questions:
Is there a way to change the flag to a custom image icon in the language switcher?
※Only the current language

June 30, 2024 at 10:49 am #15862053

Bigul
WPML Supporter since 01/2013

Languages: English (English )

Timezone: Europe/Vienna (GMT+02:00)

Hello,

Welcome to the WPML support forum. I will do my best to help you to resolve the issue.

It looks like you have to create a custom language switcher to achieve this requirement. Please check the following documentation and tickets for more details.

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

https://wpml.org/forums/topic/how-can-i-create-a-custom-language-selector-from-scratch/#post-14804695

https://wpml.org/forums/topic/creating-a-custom-language-switcher/#post-12040199

Also as a simple workaround you can also consider changing the by default language flags from WPML>>Languages>>Site Languages>>Edit Languages. Refer to the following links for more details.

hidden link

https://wpml.org/documentation/getting-started-guide/language-setup/editing-wpmls-languages-table/

--
Thanks!

Bigul

July 2, 2024 at 3:14 pm #15876507

安 漢成

Dear Bigul,

Hi, Thank you for your advice and reply.

Based on your advice, I modified class-wpml-ls-model-build.php and resolved the issue.
I might need to change the CSS to make it look nice... I'll close this for now.

Best regards,
an