-
AuthorPosts
-
October 27, 2020 at 7:43 pm #1256181
Hi Enfold Support
I am using WordPress version 5.5.1, Enfold theme version 4.7.6.4 and the latest versions of WPML. The default language is German, and the second language is English.
On some pages, there is an Easy Slider showing a few images. Each image is clickable and opens the images in Lightboxes. Most images are the same for German and English. The titles translated using WPML Everything is fine and as expected.
A few images differ from German to English. The WPML Media Translator is used to replace the image for English. In German, all is fine.
Switching to English, for displaying the Easy Slider, it takes the images for the defined language, and it works fine.
The problem is when clicking the image; the Lightbox opens the German image, not the English one. On the other hand, titles are correctly in English.
The Link to the Lightbox does not consider the language and not take the replacement.
Any solution?
I really appreciate any help you can provide.
Best regards,
AndreasOctober 28, 2020 at 9:13 am #1256292BTW: I found a support ticket (in German) at the WPML support forum explaining the same problem I have. In the end, they assign the issue to enfold.
Unfortunately, the mentioned workaround does not work with me. With my image.php file, there is no such line
“$link = aviaHelper::get_url($link, $attachment);”.
Therefore, I don’t know where to add the workaround.We are just before the launch of the new website. We would much appreciate the help.
November 3, 2020 at 4:28 am #1257858Hi,
Thank you for the inquiry.
The line that they mentioned is located around line 669 of the image.php file.
$link = AviaHelper::get_url( $link, $attachment );
You have to insert this snippet before the code above.
$attachment = apply_filters('wpml_object_id', $attachment, 'attachment', TRUE );
Best regards,
IsmaelNovember 3, 2020 at 1:18 pm #1257983Hi Ismael
Thanks, you are right. Now, I found the line and made some tests.
Unfortunately, the workaround does not work with our site. Please investigate the problem further and solve it with the next release, as I am not the first with that issue.
Meanwhile, I found a very, very complicated and time-consuming own workaround based on manual linking approach.
Regards,
AndreasNovember 8, 2020 at 3:21 pm #1259116Hi,
Thank you for the update.
What do you mean by manual linking approach? Did you purge the cache after doing the modification? Please create a clone or a staging version of the site so that we could inspect the issue further. Post the site details in the private field.
Best regards,
IsmaelNovember 9, 2020 at 11:33 am #1259212Hi Ismael
Manual linking approach: “Easy slider” > select image > “advanced” “Link Einstellungen” “Link zu Bild hinzufügen” I used instead of “Öffne Bild in einer Lightbox” > “Manuell festlegen >https://… URL to the Englisch image. But, as it sounds simple, it was not done. Image sizes differed from opened in Lightbox to Manually link. I had to change setting for WordPress media “large”, recreate Media Library and all the steps within WPML. The strange thing in WPML was that I had to find the assignment of the English URL for the pictures within WPML String Translation, It sown the correct link, delete it, saves it, and enter the equal again and save it and then it worked. That is what I mean with “very, very complicated and time-consuming own workaround based on manual linking approach”.
Did you purge the cache after doing the modification? If something does not work as I expect, I have become accustomed to first clear cache. It is a standard procedure.
I stetted up a clone to see and reproduce the behaviour.
I am curious about your findings.
Regards,
AndreasNovember 11, 2020 at 3:01 pm #1259894Hi,
Thank you for the update.
Manual linking approach: “Easy slider” > select image > “advanced” “Link Einstellungen” “Link zu Bild hinzufügen” I used instead of “Öffne Bild in einer Lightbox” > “Manuell festlegen >https://…
Defining the URL manually or setting the image URL manually will not work because WPML has to know the ID of the attachment in order to retrieve the other version of the image in another language. Unfortunately, image or attachment post type is not available in the Image Link? drop down.
Best regards,
IsmaelNovember 11, 2020 at 4:03 pm #1259908Hi Ismael
I think you misunderstood me. The manual link using the URL was complicated to use, but, is the way which works fine. A language specific URL for English image is used.
What does not work is using the LightBox. As I mentioned, the Easy Slider shows the right image in the correct language. But when clicking the Easy Slider, the LightBox always shows the German image instead of the English one. WPML supports writes that this is a known Enfold problem. You can see it with the clone as mentioned.
Best regards,
AndreasNovember 15, 2020 at 5:33 am #1260555Hi,
Thank you for the clarification.
It might not be working because we modified the image.php file instead of the template file for the slideshow. Please try to edit the enfold\config-templatebuilder\avia-shortcodes\av-helper-slideshow.php file, and look for this code around line 360:
$link = wp_get_attachment_image_src( $slide->ID, $this->config['lightbox_size'] );
.., then replace it with:
$link = wp_get_attachment_image_src( apply_filters('wpml_object_id', $slide->ID, 'attachment', TRUE ), $this->config['lightbox_size'] );
This should allow WPML to filter the slide ID or use the appropriate image from another language before returning it to the template.
Best regards,
IsmaelNovember 16, 2020 at 8:03 pm #1260778Hi Ismael
I found the string on line 334 and replaced it with your input on the clone installation.
Sorry, to say, but it does not change the behaviour. Selecting the language English, clicking the Easy Slider preview, the LightBox still shows the German image instead of the English.
Indeed, I checked all the WPML translation settings and assignments. All they are correct.
Regards,
AndreasPS: Clone to reproduce is still available.
November 23, 2020 at 3:56 am #1262228Hi,
Sorry for the delay. We would like to test this further but the clone is no longer available. Did you take it down? Please include the FTP details in the private field so that we could edit the files when necessary.
Best regards,
IsmaelNovember 23, 2020 at 1:58 pm #1262371Hi Ismael
See private content.
Regards,
AndreasNovember 26, 2020 at 5:04 am #1263162Hi,
Thank you for the info.
We found out that the lightbox link or image URL is retrieved using the generic get_url function, so we modified the config-templatebuilder\avia-template-builder\php\generic-helper.class.php file around line 267 and applied the same WPML filter.
$link = wp_get_attachment_image_src( apply_filters('wpml_object_id', $slide->ID, 'attachment', TRUE ), apply_filters( 'avf_avia_builder_helper_lightbox_size','large' ) );
The lightbox is now displaying the appropriate images from the current language. (see private field)
Best regards,
IsmaelNovember 28, 2020 at 9:47 pm #1263703Hi Ismael
Now it works. Please fix it permanently with the next maintenance release.
Thanks,
AndreasNovember 29, 2020 at 9:16 pm #1263822Hi,
If you need additional help, please let us know here in the forums.
Best regards,
Jordan Shannon -
AuthorPosts
- The topic ‘WPML / Easy slider / image links to Lightbox / wrong picture when language diff’ is closed to new replies.