Sydney Pro Theme - Language Responsive Crelly Slider with WPML

Hi,

I have a site that is multi-language and I am using WPML. My header is using the Crelly Slider.
However, the Crelly Slider does not respond to the current language of the site. I’ll appreciate your assistance to resolve this.

Thanks,
CM

Hello CM,

It happens due to your site only loads single Crelly Slider defined in the customizer. The solution for this is create multiple sliders with the respective languages. To display the slider based on current activate language, you should edit the Crelly Slider call definition in the theme’s function – its in sydney_slider_template() in the inc/slider.php file.

To retain code changes when theme gets updated in the future, you should use a child theme. In the child theme’s functions.php file, add this code. Then find this line:

crellySlider($alias);

then create WPML language check wrapper and specify which slider have to be displayed.

    if(ICL_LANGUAGE_CODE=='en'){
       crellySlider('My_Slider_1');
    }

    if(ICL_LANGUAGE_CODE=='ja'){
       crellySlider('My_Slider_1');
    }

Adjust en and ja to your language codes.

Regards,
Kharis

Hi Kharis,
I guess you have a typo in your code?! Isn’t it supposed to be

for the second language code?

What I’m struggeling with is the following: The CrellySlider mentioned in the customizer is always active … So I get two sliders displayed in one of the languages (The one selected by the newly added function AND the one mentioned in the customizer CrellySlider entry. Any ideas how to avoid this?

Maybe by now there’s even a better way to solve the CrellySlider language problem - since the post is 2 years old already :wink:

Cheers, Timo

OK, I found the problem.
first of all delete the line:

crellySlider($alias);

and than use this block instead:

if(ICL_LANGUAGE_CODE=='en'){
   crellySlider('My_Slider_1');
}

if(ICL_LANGUAGE_CODE=='ja'){
   crellySlider('My_Slider_2');
}

This worked for me …

1 Like

Great! Glad to know you got it corrected by yourself.

Please let us know in a new topic if you have any further questions, or if we can provide you with any other assistance.

Regards,
Kharis
aThemes Support