Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #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,
    Andreas

    #1256292

    BTW: 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.

    https://wpml.org/de/forums/topic/lightbox-zeigt-nicht-das-in-wpml-media-translation-hochgeladene-image/#post-4932831

    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.

    #1257858

    Hi,

    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,
    Ismael

    #1257983

    Hi 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,
    Andreas

    #1259116

    Hi,

    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,
    Ismael

    #1259212

    Hi 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,
    Andreas

    #1259894

    Hi,

    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,
    Ismael

    #1259908

    Hi 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,
    Andreas

    #1260555

    Hi,

    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,
    Ismael

    #1260778

    Hi 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,
    Andreas

    PS: Clone to reproduce is still available.

    #1262228

    Hi,

    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,
    Ismael

    #1262371

    Hi Ismael
    See private content.
    Regards,
    Andreas

    #1263162

    Hi,

    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,
    Ismael

    #1263703

    Hi Ismael

    Now it works. Please fix it permanently with the next maintenance release.

    Thanks,
    Andreas

    #1263822

    Hi,

    If you need additional help, please let us know here in the forums.

    Best regards,
    Jordan Shannon

Viewing 15 posts - 1 through 15 (of 15 total)
  • The topic ‘WPML / Easy slider / image links to Lightbox / wrong picture when language diff’ is closed to new replies.