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 4 replies, has 2 voices.

Last updated by Andreas W. 3 months, 1 week ago.

Assigned support staff: Andreas W..

Author Posts
July 8, 2019 at 11:35 am #4161923

romauldT

Tell us what you are trying to do?

I am trying to display images called by an ACF image field to a translated version of a page.

I am trying to fix the issue on the field hero_image so that I can recreate the correct settings throughout the site.

I have the ACF field set to "translate" and have a translated version of the image.

On my original language page (English) when I inspect the image in devtools I see the URL. When I look at the translated page (French) the I no longer get the URL but the image ID instead. I have looked at various topics on your support forum but can't seem to recreate the solutions detailed on those posts.

Is there any documentation that you are following?

The "How to handle Image and other post object fields" guide:

https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/#how-to-handle-image-and-post-object-fields

Is there a similar example that we can see?

See images

What is the link to your site?

My site is currently hosted on a local server during development. I can create a duplicator file if required.

Thanks for your assistance.

July 8, 2019 at 7:05 pm #4165219

Andreas W.
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

Thank you for contacting the WPML Support Forum.

The Advanced Custom Fields plugin offers options ofr each custom field inlcuding an image. You should be able to select here the option "ID". Please apply the option to the default language image custom field and translate the page including the field again.

Does it solve the issue?

Kind regards
Andreas

July 9, 2019 at 7:22 am #4167975

romauldT

My issue is resolved now. Thank you!

Per Andreas's suggestion I recoded the ACF field to call the images by ID rather than URL and now the translated images are being called perfectly.

July 9, 2019 at 9:37 am #4169075

romauldT

Hi

I thought that this had solved my issue but it hasn't.

When I followed the advice of changing the URL to ID and tested it with my hero image and checked the translated page it seemed to work. However when I came to change the settings for subsequent images src is "unknown".

When I changed the hero image to see if the ID fix had worked the image changed on my page in the original language but for some reason the translated page was calling a different image.

The image I have changed on the original language page is not associated with the image being called on the translated page. I have no idea why it is being called.

I have tried to delete and reinstall the plugins to start fresh and make sure that I have no conflicts anywhere but the settings seem to carry back over when I reload.

The image is being called with the following code:

<?php $image = wp_get_attachment_image_src(get_field('hero_image'), 'full'); ?>
                            
<img src="<?php echo $image[0]; ?>" alt="<?php echo get_the_title(get_field('hero_image')) ?>">

I feel like I have followed the implementation instructions to the letter and any urgent help would be much appreciated.

Thanks

July 9, 2019 at 3:51 pm #4172809

Andreas W.
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

I would like to request temporary access (wp-admin and FTP) to your site to take a better look at the issue. It would be better to a testing site where the issue is replicated.

You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.

Maybe I'll need to replicate your site locally. For this, I’ll need to temporarily install a plugin called “Duplicator” on your site. This will allow me to create a copy of your site and your content. Once the problem is resolved I will delete the local site. Let me know if this is ok with you.

IMPORTANT

Please make a backup of site files and database before providing us access.
If you do not see the wp-admin/FTP fields this means your post & website login details will be made PUBLIC. DO NOT post your website details unless you see the required wp-admin/FTP fields. If you do not, please ask me to enable the private box. The private box looks like this:
hidden link

Kind regards
Andreas

The topic ‘[Closed] ACF image field translation’ is closed to new replies.