Skip Navigation

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 2 replies, has 3 voices.

Last updated by Pierre 3 weeks, 1 day ago.

Assigned support staff: Rajeeb Banstola.

Author Posts
July 9, 2019 at 7:58 pm #4174183

markD-33

Hi,

This website i'm working on (dev: hidden link) uses Ajax for naviguation and the language switcher always brings me back to the last page I refreshed to, not the last page Ajax called. Is there something I can do to tell the language switcher what the current page is?

Thank you.

July 9, 2019 at 10:28 pm #4174643

Rajeeb Banstola

Hi,

Thank you for contacting WPML!

I reviewed your site and problem here seems to be the fact that when AJAX loads content, the menu remains unchanged.

You will need to create a new function to call the menu via AJAX as well. When the page opens in the secondary language, you will need to call this second function to load the menu as well.

Unfortunately, this will require custom code is outside the scope of our support.

You can find the list of available hooks that help in the development of this feature here:

https://wpml.org/documentation/support/wpml-coding-api/wpml-hooks-reference/

If you are looking for someone proficient with WPML and custom development, I suggest you to look at WPML contractors here:

https://wpml.org/contractors/

Let me know if you require any other help!

Best,

September 1, 2020 at 12:40 pm #6915657

Pierre
Supporter

Languages: English (English ) French (Français ) Portuguese (Brazil) (Português )

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

Hi @markd-33,

In WPML 4.4.0, we introduced a feature to watch the AJAX requests related to site navigation and automatically update the language switchers. This feature needs to be enabled in the theme with a simple filter hook (https://wpml.org/wpml-hook/wpml_ls_enable_ajax_navigation/).

I invite you to test this filter hook and suggest the theme's author to include it in his code.

Note that this feature will work only if the AJAX request provides the full content (so WPML can extract and replace the language switchers).

Thanks,
Pierre