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 thread is resolved. Here is a description of the problem and solution.

Problem:
The client needed to use a custom language switcher without the flags

Solution:
1) Add this PHP action to add a language switcher to the theme code

//======= Language Switcher Code ============
echo '<div class="custom-wpml-selector">';
    do_action('wpml_add_language_selector'); 
echo '</div>';
//======= End of the Language Switcher Code ======

2) Customize the language switcher on the "WPML > Languages > Custom language switchers" to remove the flags.

This topic contains 10 replies, has 2 voices.

Last updated by Diego Pereira 1 year, 5 months ago.

Assigned support staff: Diego Pereira.

Author Posts
May 15, 2018 at 9:22 am #2133588

sharine-maliniN

How to edit this text and remove the flag.

May 15, 2018 at 9:00 pm #2147624

Diego Pereira
Supporter

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

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

Hello @sharine-malinin, welcome to the WPML support forum!

The language switchers are added and customized on the WPML -> Languages menu on your WordPress dashboard. Here you can choose where to display it and what information it will contain like names, flags, etc (see screenshot).

Apparently your menu has been added through the "menu language Switcher" section.

Here is the link of the documentation, with more information that may be helpful: https://wpml.org/documentation/getting-started-guide/language-setup/language-switcher-options/

Please let me know if it worked for you.

All the best,
Diego

May 16, 2018 at 1:00 am #2148910

sharine-maliniN

I want to use shortcode. I manage to do that, but now its on two side.

How to remove the text on left And to remove the 'word' Chinese (Simplified) word

May 16, 2018 at 12:34 pm #2157013

Diego Pereira
Supporter

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

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

Hi @sharine-malinin

If you are using shortcode, you can edit the content through the arguments. In your case it would be necessary to modify the arguments "flags" and "translated" to 0.

Your shortcode would look something like this:

[wpml_language_switcher type="widget" flags=0 native=1 translated=0][/wpml_language_switcher]

This is the list of arguments you can use to customize your shortcode:

  • type – Define the language switcher type – footer, post_translations, widget or custom (default).
  • flags (alias for display_flags) – Use 1 to display flags and 0 not to.
  • link_current (alias for display_link_for_current_lang ) – Use 1 to display flags and 0 not to.
  • native (alias for display_names_in_native_lang ) – Use 1 to display flags and 0 not to.
  • translated (alias for display_names_in_current_lang ) – Use 1 to display flags and 0 not to.
  • template – The template slug if it needs to be overwritten. Otherwise it will be defined by the type .

Here is the documentation page: https://wpml.org/documentation/support/wpml-coding-api/shortcodes/

Please let me know if it worked for you.

Regards,
Diego

May 17, 2018 at 2:14 am #2166218

sharine-maliniN

You did not tell me how to remove the language display on left side. i only need the selection to display on right side

And how to make it display on lide NOt dropdown

May 17, 2018 at 2:12 pm #2177334

Diego Pereira
Supporter

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

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

Hello @sharine-malinin,

Can you send us access to the WordPress dashboard of your website? This way I can check how Language Switcher has been implemented on your website and tell you exactly how to modify it (maybe I can even modify it for you).

Here are the information I need:
- Website URL
- Admin login and password

IMPORTANT: Please use the private field to send me the access data, so the information will not be displayed in the public forum.

May 17, 2018 at 11:03 pm #2184327

sharine-maliniN

Hi

Also the changes on string is not working. can you help. i try but he did not make changes

May 17, 2018 at 11:25 pm #2184503

sharine-maliniN

Hi
Diego Pereira,

Sorry for the all the confusion. MY Client prefer the language selection on right

If you see now hidden link

Just help to remove the word (Chinese (Simplified)) word beside the Chinese native language

and the flag in the section is not removing

Please help

May 18, 2018 at 12:47 pm #2189064

Diego Pereira
Supporter

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

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

Hi @sharine-malinin,

Done! Now you can customize this language switcher on the WPML > Languages > Custom language switchers.

I needed to edit some things in your theme file (header/header-top-bar.php).

On line 26, I commented the snippet responsible for displaying the flag. It looks like a configuration of your theme (not related to WPML). You can remove the two bars at the beginning of the line to display it again if you want.

//echo gdlr_core_escape_content($language_flag);

I also added this code snippet on line 35 to display the language switcher.

//======= Language Switcher Code ============
echo '<div class="custom-wpml-selector">';
    do_action('wpml_add_language_selector'); 
echo '</div>';
//======= End of the Language Switcher Code ======

Please let me know if it worked for you.

All the best,
Diego

May 19, 2018 at 6:51 am #2193193

sharine-maliniN

Thanks, you are amazing For the flag i will do,

May 21, 2018 at 11:58 am #2200829

Diego Pereira
Supporter

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

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

Hi, I am happy to know 🙂

If you need more help just open a new ticket.

All the best,
Diego