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

Last updated by Cliona 1 year, 11 months ago.

Assisted by: Bobby.

Author Posts
May 16, 2023 at 5:51 pm #13658975

Cliona

HI

My site needs ajax to run the radio player,

The links to change language don't seem to refresh the menu in the correct language,
Can you give me any help

I need to add call backs to my theme -
hidden link

Thanks

May 16, 2023 at 7:59 pm #13659509

Bobby
WPML Supporter since 04/2015

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Hello,

To enable language information for the front-end AJAX calls, go to WPML → Languages and scroll down to the Language filtering for AJAX operations section

Relevant Documentation: https://wpml.org/documentation/getting-started-guide/language-setup/enabling-language-cookie-to-support-ajax-filtering/#:~:text=To%20enable%20language%20information%20for,language%20filtering%20for%20AJAX%20option.

Let me know your results, please.

May 16, 2023 at 8:37 pm #13659621

Cliona

Hi Bobby

Thanks I have enabled that option, but still the navigation doesn't update until i refresh the page. Changing the language doesn't seem to refresh the header it just changes the content on the pages.

Any other suggestions be greatly appreciated

May 17, 2023 at 4:59 pm #13666745

Bobby
WPML Supporter since 04/2015

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

I can see the issue on the site and do notice that once the page is refreshed the header updates.

The rest of the content works as expected. Is this a custom header you are coding or coming from the theme? Possibly you could use the following WPML Hook https://wpml.org/wpml-hook/wpml_ls_enable_ajax_navigation/

Let me know your results, please.

May 17, 2023 at 6:25 pm #13667371

Cliona

Thanks, This is not a custom header. it is coming from the theme.
Do i need to add the hook into the theme or within the wpml plugin.

I think the ajax response is not refreshing the header.
I'm looking for a way to either hard code or add as part of navigation to refresh the page when switching languages.

May 18, 2023 at 12:29 am #13668475

Bobby
WPML Supporter since 04/2015

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

This feature detects AJAX navigation and automatically updates the language switcher links without the need to reload the page.

This feature needs to be enabled by the theme via a simple filter hook wpml_ls_enable_ajax_navigation. (You can add the hook in functions.php)

I'd recommend first contacting the theme’s author so they can enable the feature depending on the theme settings using our provided hook.

Let me know your results, please.

May 22, 2023 at 12:14 pm #13689725

Cliona

Hi

I have been able to add a custom language switcher i the header.
But when I move around the pages or scroll down and back up. The switcher disappears.
Can you think of any reason?

I have added the
<?php do_action('wpml_add_language_selector'); ?>
Into the header

May 22, 2023 at 5:28 pm #13693259

Bobby
WPML Supporter since 04/2015

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Thank you for updating me!

Unfortunately, I am not sure what could cause this. This would be better answered by the theme developer as they know their code best as it is the theme's code that interferes with the WPML language switcher once it's placed in a header or menu.

May 22, 2023 at 5:53 pm #13693295

Cliona

Ok thanks for your help Bobby

May 22, 2023 at 5:53 pm #13693301

Cliona

Thanks