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

Last updated by Yvette 4 months, 3 weeks ago.

Assigned support staff: Yvette.

Author Posts
May 21, 2019 at 9:23 am #3853511

ianM-17

I picked up this project in the time when a few issues came to light. I did not develop the theme or was involved in the initial set up and sending the tranlation job to the agency translating the content.

Trying to figure out the various issues I really appreciate your guidance so far.
In previous tickets people have been really helpful with some missing settings that should ensure the Featured Image of the them are being copied over with translations.
Unfortunetly, whilst those guidance are valid, it seem to have not done the trick to resolve this issue.

I am digging a bit deeper and can see in the theme files and inspecting the page source code that the Featured Image is in fact being used as a background image and not in an <img> tag.
Which makes me wonder if this could be the reason why the usual necessar settings have not been working.

Here is the function beign used for the Featured Image:

$image_src = null;

// Determine what image to use as the banner background.
if ( is_archive() && !is_home() ) {
	// Get non-thumbnail image using a suitable method for project requirements.
	if ( is_post_type_archive() ) {
		$cpt       = get_queried_object();
		$image_src = m3_get_cpt_archive_image_src( $cpt->name, 'full' );
	}
} else {
	if ( has_post_thumbnail( $post->ID ) ) {
		$image     = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
		$image_src = $image[0];
	}
}

$background_image_css = $image_src ? "background-image : url( '{$image_src}' )" : '';

You can also see it in the source code of pretty much all of the pages of the site.

I have been looking at this thread on your forum: https://wpml.org/forums/topic/thumbnails-and-pictures-are-missing-in-the-translated-page/
And followed the instructions with the settings under WPML -> Media Translation
Attached is the image of the Media Translation Settings.

With all of this in place am I missing something? Or do I need to do something else, because of how the use of the Featured image is set up?

Thank you in advance.

May 22, 2019 at 8:47 am #3863213

Yvette
Supporter

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

Timezone: Europe/Madrid (GMT+02:00)

Hi

What exactly is the "front-end" or "back-end" problem with the featured image?

Is it that you need a different image to appear on the frontend and it is not appearing?

In general, with Media Translation, the custom field "thumbnail_id" is considered to be the "featured image" and it is translated using the WPML Media Tranlsation module. The "duplication" of the custom field form one postmeta to it´s associated translations, is done by the core function WPML > Settings > WPML Media Tranlsation.

This will copy the custom field to the post meta but it does not influence what a theme/plugin might then do with that image.

May 22, 2019 at 4:26 pm #3868143

ianM-17

Thank you for your reply.
I am referencing a previous ticket where you kindly helped me before with the same issue:
https://wpml.org/forums/topic/featured-images-not-appearing-in-translated-sites/#post-3666491

Unfortunalty this did not resolve the issue.
I simply need to copy all featured images from the default language to translated versions.
This however is just not happening.

I included the code for displaying the featured image from the theme template file.
It takes the URL from the uploaded featured image and display it as a background image. Therefor not in an <img> as per usual.
That is why I am wondering if this is the reason there are issues getting it copied over to translations. How does WPML handle images in this situation.

When I send a translation to myself from admin, and translate the page, when viewing the translated page in the browser (front end) - the image does not show. And there is no URL for the background image in the source code. The featured image is also not in the admin side of the page.

You can use the same credentials I gave you here: https://wpml.org/forums/topic/featured-images-not-appearing-in-translated-sites/#post-3666491 if you want to have a quick poke around to see what I mean.

I would like to know if there is a work around to make this work somehow or any other ideas?

Thank you in advance.

May 23, 2019 at 10:18 am #3873577

Yvette
Supporter

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

Timezone: Europe/Madrid (GMT+02:00)

Hi - the private information is removed for your safety once the ticket is closed.

So, can you please provide it again? I am opening the private area for system access info.
Thanks

May 23, 2019 at 1:20 pm #3875707

ianM-17

Thank you Yvette.

I did add in the info, but when I posted it, it did not seem to be private.
Can you perhaps do the setting again, so that I can add a private message?

May 23, 2019 at 1:33 pm #3875775

Yvette
Supporter

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

Timezone: Europe/Madrid (GMT+02:00)

Here I´m trying this again.

May 23, 2019 at 1:45 pm #3875949

ianM-17

Thank you!
But I think I messed it up now.
I know now where I go wrong.
If you don't mind, one last time please.

May 24, 2019 at 5:59 am #3881309

Yvette
Supporter

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

Timezone: Europe/Madrid (GMT+02:00)

Here you go.

You can also post it and I will store it somewhere else secure and delete it from the message.

May 27, 2019 at 4:09 pm #3899543

Yvette
Supporter

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

Timezone: Europe/Madrid (GMT+02:00)

Hi - the password is userid/pwd combo is not being accepted when I cut&paste them into the login screen. Can you double check the credentials please?

May 29, 2019 at 1:53 pm #3916217

Yvette
Supporter

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

Timezone: Europe/Madrid (GMT+02:00)

Finally - I´m in!

May 29, 2019 at 2:30 pm #3916411

Yvette
Supporter

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

Timezone: Europe/Madrid (GMT+02:00)

OK - now that I have access.....you wrote: "..When I send a translation to myself from admin, and translate the page, when viewing the translated page in the browser (front end) - the image does not show. And there is no URL for the background image in the source code. The featured image is also not in the admin side of the page...

Please send me a clear example of this and steps on how I can replicate this on your site. Is this happening for only a single post type?

Please set up a very simple example if possible.

The topic ‘[Closed] Featured image as background image – make it translatable’ is closed to new replies.