We have just released WPML 4.3.3. Before reporting issues please make sure to update - this version resolves all known issues with the major WPML 4.3 release

Hi, Amit here, I am the WPML Support Manager, our current ticket queue is high, update your WPML plugins and make sure you meet the minimal requirements for running WPML before reporting an issue please - many tickets are resolved doing that

Please look at our updated list of Known Issues and you can also use our support search to find helpful information and of course review our documentation before opening a ticket.

If you do need to open a ticket please make sure to provide us with all the needed information as described in this page

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: Make the language switcher appear on the top header (i.e. above the main menu header)

Solution: It was sufficient to change the configuration of the language switcher to use the menu "Top Navigation".

You can set this in WPML -> Languages -> Language switcher options -> Language switcher in the WP menu.

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

This topic contains 5 replies, has 2 voices.

Last updated by John T. 3 years, 5 months ago.

Assigned support staff: Yvette.

Author Posts
May 20, 2016 at 3:33 am #886671

John T.

I am trying to: make the language switcher appear on the top header (i.e. above the main menu header) on the left side of 'My Account' link. For your information, I'm using Avada theme.

URL of (my) website where problem appears: hidden link

Instead, I got: the language switcher appearing in the main menu header.

My request is similar to this ticket <https://wpml.org/forums/topic/language-switcher-into-top-bar-does-not-work-pls-help/&gt;, I think. But since there might be different ways to do this in different themes (especially when it comes to coding), please confirm the steps to make this happen.

Best regards,

John

May 20, 2016 at 9:31 am #886885

Yvette
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+01:00)

Hello.

Yes, the precise procedure would depend on your particular theme but I am including a detailed example for the Divi theme. Please review it and let me know if you have questions.

In general, adding the language switcher using the WPML hook is not theme dependent. That is to say, the general steps are the same in all themes:

1. Find the code that constructs the part of the page you want add the selector to
2. Add the following call to the theme file

<?php do_action('wpml_add_language_selector'); ?>

3. Style the language selector so that it appears as you want by adding styling directives in the WPML > Languages > Language Switcher Options > Additional CSS box.

Since I have access to a DIVI theme, I am including two examples for you to study.

[STEP 1] Finding the relevant Theme Code
In both cases, the code is contained in the header.php template of the theme. ( You should copy this file to your child theme and make any changes there or else any changes you make will be overwritten when you upgrade your theme)

The DIVI theme contains a top bar section that is divided into two general <divs>: the et-info section which holds email, telephone, social icons; and the menu-nav which can hold a menu item.

[STEP 2] Adding the code to the file
Example 1: Language Selector as first eement in the ET-Info section of the Top Bar
Example 2: Language Selector just before the Navigation section of the Top Bar

Example 1:
Please refer to the images. In this case, the hook call is placed just after the opening of the <div> for the et-info section.

Example 2:
In this case, the hook call is placed just after the opening of the <div> for the et-secondary menu section.

[STEP 3]
In both cases some styling was required to position the language switcher relative to the other div elements as well as to position the language items within the language switcher. In the examples I included, the desired effect was to have it all in a horizontal line. You may want something different. Unfortunately, my CSS skills are not too proficient to help you further in this case.

May 21, 2016 at 1:33 pm #887506

John T.

Hi Yvette,

Thank you for your reply. Unfortunately, I'm stuck right from Step 1...

I've made a copy of header.php file and moved it to the child theme folder. Header.php now can be seen from WordPress Dashboard > Appearance > Editor. The issue now is that I can't find the relevant code, so could you please take a look at the file and tell me where I should put the code? I'm hardly a programmer after all.

Again, please note that I'm using Avada theme and I have WP-Rocket cache plugin activated.

Thanks!

John

May 21, 2016 at 8:41 pm #887569

Yvette
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+01:00)

Ok. = )

(1) Temporary Access to your system
Could you please provide access to your system (wp-admin and ftp) so that I can further investigate this particular challenge? The fields to provide this data are included in a private section that I will open for your next response. You can find it above the comments area. The information in this private section is only visible between WPML Support and you.

Thanks

May 22, 2016 at 12:26 pm #887642

Yvette
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+01:00)

Hello.

Thanks for the access. In your case, it was sufficient to simply change the configuraiton of the language switcher to use the menu "Top Navigation". (see image).

You can set this in WPML -> Languages -> Language switcher options -> Language switcherin the WP menu.

The language switcher now appears to the left of the "My Account" link as you requested.

Does this respond to your need?

May 22, 2016 at 4:33 pm #887689

John T.

Ah~ the option is there after all. Now my issue is resolved. Thank you for your support Yvette. I really appreciate it~ ^^