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.

This topic contains 22 replies, has 3 voices.

Last updated by Raja Mohammed 4 months, 1 week ago.

Assigned support staff: Raja Mohammed.

Author Posts
May 14, 2019 at 10:00 am #3805627

philippeN-2

Hi,

My website is in English (main) and French.
I am trying to translate Product pages copying medias added with ACF.
When I upload an image directly in an EN Product edition page, this image is visible in front
and get the same name of the product : /uploads/2019/04/my-product.jpg
When I duplicate the EN Post copying the img field with Multilingual Content Setup, the img is visible in the French Product edition page but not in the French front page, because it tries to load the real image slug name : /uploads/2019/04/img.jpg
In my media page, the image is visible and its URL is /uploads/2019/04/img.jpg, which doesn't display the image in front office.

I hope I'm clear and you could help me without many efforts.

Have a lovely day.

May 14, 2019 at 10:00 am #3805629

philippeN-2

Please look at this example : hidden link
Both image fields are into a repeater and are in "copy" mode in the Multilingual Content Setup but only one of them is displayed in the secondary language page.

May 14, 2019 at 11:18 am #3806259

Raja Mohammed
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

HI there,

It seems you are using ACML version 1.1 we have similar issues associated with that version. The fix is released in subsequent releases.

I would request you please update to the latest version of Advanced Custom Fields Multilingual. version 1.3, Check if you can reproduce the issue.

Also, please temporarily switch the theme to any of the WordPress default themes (eg: twenty nineteen) this will eliminate if there is an issue associated with the theme.

Please let me know the results

Kind regards
Raja

May 14, 2019 at 2:26 pm #3808133

philippeN-2

I've updated all ACF & WPML plugins to reduce as possible the mistakes, but my error is still happening.

It probably comes from my theme in which I get img URL thanks to the wp_get_attachment_image_src() function, but I suppose it'll be the same in another theme, I'll get the same need.

What is a problem for me is mainly the img name, which can sometimes be the name of the current Post where I've uploaded the image.
Have a look for example at the screenshot, where I dumped the "Choosit" img uploaded into the "Test" Post. The image has different names according to the format used.

Any idea to know how to force the image to get only the uploaded img name, not the current post ?

Thank you very very much for your help and your time !

May 15, 2019 at 5:59 am #3812419

Raja Mohammed
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

HI,

Thanks for the clarification,

I think the function you are looking for is wp_get_attachment_image() which would return the image with Alt and title text in HTML format.

Refer https://developer.wordpress.org/reference/functions/wp_get_attachment_image/

Since wp_get_attachment_image_src() will always return the post title for image Alt text. You might have to use the below code to fetch alt text as they are stored as attachment meta

$img_alt = get_post_meta($attachment_id, '_wp_attachment_image_alt', true)

I hope this helps you better.

Let me know if you need further assistance.

Kind regards
Raja

May 15, 2019 at 7:22 am #3813039

philippeN-2

Hi,

I use the wp_get_attachment_image_src() function to insert the img src into a background img, not into an HTML img tag.

I think the problem is an image can have a different name (uploaded img name or current post title) according to the img format. It doesn't make sense for me.

Thank you for your help

May 15, 2019 at 1:02 pm #3816661

Raja Mohammed
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please clarify what you are referring to as image name?

if you are using the function. wp_get_attachment_image_src() this will return the post title associated with the image which is the default WordPress behavior.

If you want to fetch the image alt text added during the upload use the code in my previous response. However, I'm not sure if this even related to WPML, since this is expected behavior in WordPress.

Kind regards
Raja

May 15, 2019 at 3:59 pm #3818609

philippeN-2

Hi,

Let's imagine an image in your laptop, named "cat.jpg".
You create an EN Post named "My animals".
When you upload cat.jpg into the Post, this image is natively created in all formats we've created before but some of them get this kind of link (hidden link) and some of them this kind (hidden link).
That is my problem I think.

About the function I use, I use this one to get an image url this these two ones, not a full HTML image tag or an alt text.

I hope I'm clear.
Thank you again !

May 16, 2019 at 6:25 am #3822221

Raja Mohammed
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Oops! pardon me, I think I didn't pick up the issue initially, it's clear for me now.

Can you please check the issue by changing to any other WordPress default theme? ,
Create a new post and copy to French translation does it still give a mixed Image name?

Please let me know is it happening in other posts as well, I have noticed the Thumbnail, media, List-view and list-view-game Image sizes are getting the post name instead of the image name. can you please check if it is happening the same in other posts.

Please check if any custom image resizes function in the theme. If you are still stuck, Send me a snapshot copy of your site so that I can take a closer look into the issue.
You can use the Duplicator plugin to create a snapshot of the site and share the package link with me http://wordpress.org/plugins/duplicator/

Kind regards
Raja

May 16, 2019 at 8:07 am #3822959

philippeN-2

Hi,

I'm glad you got what I tried to explain.
I tried to start with a WP theme and with a new Repeater>Image field.
When I upload an image into an EN Post, the image in all format fet the Post title.
It's not even possible to regenerate the thumbnails as they are not found with their original name in the uploads folder.
Isn't it possible to force an image to keep its original file name ?

May 16, 2019 at 9:28 am #3823861

Raja Mohammed
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I'm not sure what's causing the issue maybe I can inspect this with a snapshot copy of your site. You can use the Duplicator plugin to create a snapshot of the site and share the package link with me http://wordpress.org/plugins/duplicator/

I have enabled private fields for you to share the duplicator package link.

Kind regards
Raja

May 17, 2019 at 12:42 pm #3834445

Raja Mohammed
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hi,

I have requested permission to access the download.

Kind regards
Raja

May 17, 2019 at 2:43 pm #3835299

philippeN-2

Hi,

I'm sorry, I gave it to you.

Lovely weekend to you !

May 20, 2019 at 7:47 am #3844417

Raja Mohammed
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

HI,

Thanks for your understanding, I can reproduce the issue using your duplicator package. to isolate the issue please install ACF pro to our Sandbox site => One Click Login:hidden link

Let me know once done. I will look into the details soon

Kind regards
Raja

May 22, 2019 at 8:01 am #3862765

philippeN-2

Hi Raja,

Sorry for the delay.
I've uploaded & activated ACF Pro. I let you have a look and try some tests.
Please let me know if I can do something for you.

Just a question : am I the first one to get this issue ?

Thank you so much.

The topic ‘[Closed] Copy media while translating Posts’ is closed to new replies.