Skip Navigation

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

Problem:
The client is trying to customize the language switcher to only show flags, similar to the display on the WPML website.

Solution:
We recommend adding and configuring language switchers in WPML -> Languages. Scroll down to the "Language switcher options" section, where you can create a language switcher for a menu, widget, and/or footer. In the options for each language switcher, you can enable the Flag option to display only the flag.

For detailed instructions, see the following guides:

If you want to further customize the look and feel, you can use custom CSS. Here is an example of CSS that hides the button-like section and adjusts the styling:

button.sub-menu-toggle {
    display: none !important;
}

.primary-navigation .sub-menu {
    border: none!important;
    background-color: white!important;
}

.primary-navigation .sub-menu li.wpml-ls-item {
    background-color: white!important;
    padding: 0px!important;
}

li.wpml-ls-item {
    background-color: white!important;
}

.primary-navigation .sub-menu::before {
    content: none!important;
    background-color: white!important;
}

.primary-navigation .sub-menu:after {
    content: none!important;
}

.primary-navigation .sub-menu .wpml-ls-item > a {
    padding: 10px!important;
}

li.wpml-ls-item > a {
    padding: 10px!important;
}

For more information on customizing with CSS, visit How to fix styling and CSS issues for language switchers.

If this solution doesn't look relevant, 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 5 replies, has 2 voices.

Last updated by Waqas Bin Hasan 1 year, 4 months ago.

Assisted by: Waqas Bin Hasan.

Author Posts
January 23, 2024 at 7:08 am #15214178

elvinB-6

Tell us what you are trying to do? To customize the switcher to only show flags

Is there any documentation that you are following? Yes, the WPML

Is there a similar example that we can see? Yes, how it's showing on your website

What is the link to your site? hidden link

January 23, 2024 at 8:52 am #15214728

elvinB-6

Good day, any one there?

January 23, 2024 at 9:57 am #15215406

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting the support.

You can add and configure language switchers in WPML -> Languages and scroll down the page to find the "Language switcher options" section. Below this section you can create a language switcher to display on a menu, widget and/or footer.

In the options of each language switcher, you can configure what you want to display - you can just turn on the Flag option to display a flag only.

See following guides for details:

- https://wpml.org/documentation/getting-started-guide/language-setup/#language-switcher
- https://wpml.org/documentation/getting-started-guide/language-setup/language-switcher-options/#add-flag-to-language-switcher

Regards.

January 23, 2024 at 10:03 am #15215432

elvinB-6

Well noted, Will try out and let you know

January 23, 2024 at 10:10 am #15215495

elvinB-6

See the attached screenshot, what I want is to have the flags only, how do I remove the button-like section? MOre like how is showing on WPML website

Screenshot 2024-01-23 120518.png
January 23, 2024 at 1:21 pm #15216936

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Well, that depends on how you want to customize the look and feel.

I've tried following CSS on my sandbox site (hidden link):

button.sub-menu-toggle {
    display: none !important;
}

.primary-navigation .sub-menu {
    border: none!important;
    background-color: white!important;
}

.primary-navigation .sub-menu li.wpml-ls-item {
    background-color: white!important;
    padding: 0px!important;
}

li.wpml-ls-item {
    background-color: white!important;
}

.primary-navigation .sub-menu::before {
    content: none!important;
    background-color: white!important;
}

.primary-navigation .sub-menu:after {
    content: none!important;
}

.primary-navigation .sub-menu .wpml-ls-item > a {
    padding: 10px!important;
}

li.wpml-ls-item > a {
    padding: 10px!important;
}

See https://wpml.org/documentation/getting-started-guide/language-setup/language-switcher-options/how-to-fix-styling-and-css-issues-for-the-language-switchers/#customizing-a-language-switcher-with-css for more details.