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.
Tagged: Bug
This topic contains 5 replies, has 0 voices.
Last updated by Ashraf Hesham 1 hour, 22 minutes ago.
Assisted by: Ashraf Hesham.
| Author | Posts |
|---|---|
| March 16, 2026 at 10:00 am #17899351 | |
|
rustumT |
I have translated my LayerSlider via the Other texts (Strings) section on the Translation Dashboard. The issue is the slider text was translated successfully, but the links on the LayerSlider were not translated. |
| March 16, 2026 at 12:32 pm #17900268 | |
|
Ashraf Hesham WPML Supporter since 12/2025 |
Hi, I'm Ashraf from the WPML Dev team, I'm here to try to help you resolve your issue. I would like to ask you please for access to your site's admin panel so that can start looking into the issue more closely and try to understand and fix it. I've marked your next message to be "private" to secure the login credentials you're going to share. Looking forward to your reply, Regards! |
| March 16, 2026 at 1:24 pm #17900505 | |
|
Ashraf Hesham WPML Supporter since 12/2025 |
Thanks! We'll look into it and get back to you once we have an answer or a solution for it. Regards. |
| March 18, 2026 at 12:36 pm #17908050 | |
|
Ashraf Hesham WPML Supporter since 12/2025 |
Hi again! Thank you for your patience. I've investigated the issue you mentioned here about the link translating inside LayerSlider layers. It appeared that the author of the plugin is not including link URLs in their compatibility layer, so we are recommending that you communicate with the author of the plugin and make a request to add links translation compatibility with WPML from their side. From our side we'll communicate with the author too. As for now, I can assist you with a workaround that you can use to translate links for your Sliders until the feature is supported in LayerSlider plugin, the workaround is as follows: 1. You need to register the URL strings to WPML string translation and translate them To do that you need to:
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'] );
}
}
- This way you're registering each URL string added into a slide sub-layer to WPML's string translation 2. You need to edit and re-save the slider 3. You need to translate the registered strings 4. You need to change how the URL is going to be rendered on frontend
// Add layers
if(!empty($slide['layers']) && is_array($slide['layers'])) {
...
Add the following code block:
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']}");
}
5. Test on frontend If you need any further help please don't hesitate t ask. |
| March 18, 2026 at 1:30 pm #17908234 | |
|
rustumT |
Hi Ashraf, Thanks for this. I will contact the plugin developers on this as noted. *Just one question before I add in your workaround code as above directly to the plugin. > I know it is more likely a question for the plugin developers, but is there a way to 'override' /wp-content/themes/enfold/config-layerslider/LayerSlider/assets/wp/actions.php in my child theme instead of editing the plugin file directly? Once you confirm, I will test this all out and translate the strings for the URLs as needed. Thanks. |
| March 18, 2026 at 1:43 pm #17908305 | |
|
Ashraf Hesham WPML Supporter since 12/2025 |
Hi! Well for the code inside "actions.php" the string registration hook fires when the slider is saved in the admin, I think you can replicate this in "functions.php" of your child theme by hooking into LayerSlider's save action:
// In enfold-child/functions.php
add_action('layerslider_pre_parse_data', function($sliderID, $data) {
if (!empty($data['layers'])) {
foreach ($data['layers'] as $slide) {
if (!empty($slide['sublayers']) && is_array($slide['sublayers'])) {
foreach ($slide['sublayers'] as $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']);
}
}
}
}
}
}, 10, 2);
But for the edits in "slider_markup_html.php" it would be hard, it requires a direct edit to slider_markup_html.php because LayerSlider doesn't provide a filter hook at the point where layer URLs are rendered. This means the slider_markup_html.php change will need to be re-applied after each LayerSlider update. In the end I think it's better to ask the plugin's author to provide the most relevant and safe way to apply the workaround. Regards! |