WPML
Status
Waiting for author
Topic tags
Compatibility

Overview of the issue

When using LayerSlider with WPML, you might experience an issue where links added in Layer Settings > Link are not translated on the front end, even when the slider content itself is translated.

Workaround

Workaround 1 – No code (recommended)

This workaround only works for internal links.
  • Go to “Layer Settings > Link > Layer Linking”
  • Click on “Choose Post or Page” and select the correct post/page
  • Save your slider
  • WPML will be able to translate automatically the link

Workaround 2 – Code change

Please, make sure of having a full site backup of your site before proceeding. 1. Register the layer URL strings for translation
  • Open the …/wp-content/themes/enfold/config-layerslider/LayerSlider/assets/wp/actions.php file.
  • Look for line 886.
  • Replace:
    foreach($data['layers'] as $slideIndex => $slide) {
            
  • With:
    foreach($data['layers'] as $slideIndex => $slide) {
    
        foreach ( $slide['sublayers'] as $index => $sublayer ) {
            if ( ! empty( $sublayer['url'] ) ) {
                $string_name = "slider-{$sliderID}-sublayer_link-{$sublayer['url']}";
                do_action( 'wpml_register_single_string', 'LayerSlider Sliders', $string_name, $sublayer['url'] );
            }
        }
            
2. Render translated URL on the frontend
  • Open the …/wp-content/themes/enfold/config-layerslider/LayerSlider/assets/includes/slider_markup_html.php file.
  • Look for line 702.
  • Replace:
    if( ! empty( $layer['props']['url'] ) ) {
            
  • With:
    if( ! empty( $layer['props']['url'] ) ) {
    
      $layer['props']['url'] = apply_filters( 'wpml_translate_single_string', $layer['props']['url'], 'LayerSlider Sliders', "slider-{$id}-sublayer_link-{$layer['props']['url']}");
            
3. Re-save the slider
  • Edit the original slider
  • Save or publish the slider again
4. Translate the registered URL strings
  • Go to WPML > String Translation
  • Filter by the LayerSlider Sliders domain
  • Translate the registered URL strings

All known issues →