Skip Navigation

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.

Sun Mon Tue Wed Thu Fri Sat
- 6:00 – 12:00 8:00 – 12:00 6:00 – 12:00 8:00 – 12:00 6:00 – 12:00 -
- 13:00 – 15:00 13:00 – 17:00 13:00 – 15:00 13:00 – 17:00 13:00 – 15:00 -

Supporter timezone: America/Lima (GMT-05:00)

Tagged: 

This topic contains 25 replies, has 2 voices.

Last updated by Nicolas V. 1 year, 8 months ago.

Assisted by: Nicolas V..

Author Posts
April 13, 2023 at 8:11 am #13461983

johnP-61

Tell us what you are trying to do?

On the translated pages, I need to change some imagery, but can't see how to achieve this (as everything is edited using a different editor). I've tried switching to the classic editor as well, but still can't see where I would change the images.

The pages we've "translated" for now are all in English, but will be in UK (default), US and Australian versions. The imagery is really the key part of having the different national pages for us.

Is there any documentation that you are following?

Is there a similar example that we can see?

What is the link to your site?

gdg.travel

April 13, 2023 at 4:58 pm #13467069

Nicolas V.
Supporter

Languages: English (English ) French (Français )

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

Hello,

Welcome to the WPML support forum. My name is Nicolas and I will be happy to help you today.

WPML and String Translation will allow you to translate the texts related to the image (ALT, Caption...) but not the image itself.

To translate an image (a different image for every language) you will need to install our add-on "Media Translation".
You can download all our plugins directly from your WPML account.
- Go to https://wpml.org/account/downloads/
- Click on "Download WPML manually" to see all plugins and download them
- In your WP dashboard, go to "Plugins > Add new" and use the button at the top of your screen to upload the .zip file

Here is our documentation: https://wpml.org/documentation/getting-started-guide/media-translation/

Please let me know if this solves your issue because I don't know exactly the way you insert those images in Divi. For example, if it's an image URL that you add in a specific Divi module then you should be able to translate the url in "String Translation" or by searching for it in our Advanced Translation Editor (ATE).
Let me explain: in ATE, by default, links are hidden (urls are links). You can find them by using the search bar at the top left of the editor. If you search for "http" you will be able to see all outgoing links from that page.
https://wpml.org/announcements/2020/02/translating-links-with-advanced-translation-editor/

I hope one of those two solutions will help you out.

Nico

April 17, 2023 at 8:17 am #13484965

johnP-61

Hi Nico thanks for the message. I have tried to install the media translator plugin, but I get an error when trying to set it up (see screenshot).

Also do you know if you can you use Divi instead to build the pages? If we needed to have an entirely different layout from one translation to another can we do that?

Thanks again Nico, appreciate the support - I'm sure we'll get used to it, just learning a new system

Screenshot 2023-04-14 at 15.42.22.png
April 17, 2023 at 9:37 am #13485875

johnP-61

To add to this - another issue I have just found is that I now seem to have three lots of the same images (and anything else in our media library!) for a vast proportion of the media library. This is really not ideal for a site of ours size - how do we undo this duplication and ensure it doesn't happen again?!

Screenshot 2023-04-17 at 10.36.39.png
April 17, 2023 at 10:46 am #13487015

johnP-61

And I'm sorry to be sending another message on this thread, but I also have noticed:

1) The global footer that we have on the UK side is missing on the US and AU translated pages
2) The sites main nav should be uppercase as it is on the UK site, but is standard sentence case on the translated pages.

April 17, 2023 at 5:30 pm #13489857

Nicolas V.
Supporter

Languages: English (English ) French (Français )

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

Hello,

Let review point by point:

I get an error when trying to set it up

The warning message is about a process that will run in the background. IT should take only few minutes. Let me know if the warning is still here.

If we needed to have an entirely different layout from one translation to another can we do that?

Yes you can, for that you would need to deactivate our translation editor for that specific page and work directly with the default WordPress (using Divi, or WordPress itself). You can start from scratch (blank page or duplicate the original content first before doing your customizations and translations)
Documentation: https://wpml.org/documentation/translating-your-contents/using-different-translation-editors-for-different-pages/

I now seem to have three lots of the same images

Please note that WPML doesn't really duplicate your images (physical files) on your server. Instead WPML will duplicate your images's entries in the database in order to save translations for ALT, Captions etc...
It's wexplained in the documentation:
Please note that WPML Media Translation doesn’t duplicate any files on your site. Duplication here means that new entries are created in the database with your translated image captions, titles, meta text, and other information.

The global footer that we have on the UK side is missing on the US and AU translated pages

Because the first question was specific to images in Divi, I realized that I didn't share our tutorial about Divi itself, please read in particular the section "Translating Divi’s Custom Global Header and Footer"
https://wpml.org/documentation/theme-compatibility/divi-builder/

The sites main nav should be uppercase

It's probably an issue in the menu translation, You can review them one by one and uppercase them or for an easy workaround you can add a CSS class to do it automatically.
Right now you have those CSS rules for items in your top menu:

#top-menu li {
    display: inline-block;
    font-size: 14px;
    padding-right: 22px;
}

You can add a text-transform:

#top-menu li {
    display: inline-block;
    font-size: 14px;
    padding-right: 22px;
    text-transform: uppercase;
}

Ref: hidden link

I hope I covered all questions,
Nico

April 18, 2023 at 2:04 pm #13496775

johnP-61

Hi Nico

I think perhaps using Divi will be our easier option. I will look through your link above and see if I can get that working for us.

The media plugin install never finishes - I've left it for hours and it just stays on that loading spinner and going back, still has the message around needing to set up. I guess if we're using Divi, we won't need that plugin?

Is there a way to remove the duplicate entries for the media in the media library - we had over 2000 entries in there already, so now are at over 6000 and it's very messy to find anything? Selecting different languages in the back end doesn't change anything - everything still shows regardless of the choice there.

I will look through your other link with regards the footer not showing.

Since installing the plugin, the Divi editor is struggling to load more often than it's able to load at all, meaning we can't even edit the primary language version of the site. Is there something that WPML may have done (or does it use a lot of resources) that may be causing this?

Thanks again

John

April 18, 2023 at 3:12 pm #13497215

johnP-61

I think given we're unable to load the editor (and we need to update the main website) I'm going to have to remove all of WPML including all transalted content and start again in a more step-by-step fashion, rather than duplicating all the content etc at once. I've made a backup of the site and have gone to remove each of the additional languages, but again it seems to be taking forever to finish. In this example, you can see that that the loading spinner behind is still animating as if its still working, but the option to remove the translations for some reason is no longer greyed out (initially after clicking to remove, the "cancel" and "yes..." buttons were greyed out.

I'm really having issues here even in removing so that we can access the site as we used to pre-WPML install!

Screenshot 2023-04-18 at 16.10.36.png
April 19, 2023 at 11:25 am #13504201

johnP-61

In an attempt to fix this, I have gone through and slowly but surely managed to get the above to work in terms of apparently removing the translations - it appeared to be timing out so I have sat and clicked the "yes" button more times than I can remember until both additional languages have been removed. I then went through the steps to reset and remove WPML as detailed here https://wpml.org/faq/how-wpml-reset-works/

However, even after performing these steps, the media library is still showing three lots of every item and the Divi builder is still timing out. These problems all started with WPML so I'm not sure what has happened here but I now have a website that I cannot even edit in its primary language and have removed all traces of WPML that I am able to. Please get back to me ASAP as we have site updates that are needed and I am running out of time and options

April 19, 2023 at 4:56 pm #13506819

Nicolas V.
Supporter

Languages: English (English ) French (Français )

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

Hello,

I think we should try to solve one issue at the time to be more efficient.

1. Media translation
- I understand that the install never finished but some images were duplicated already. Could you please try this workaround script to delete all media translation:
https://wpml.org/forums/topic/script-to-delete-all-media-translations-please/
IMPORTANT: Test it on a staging copy first!

2. Reset WPML
It seems that you already reset WPML so no trace of the core plugin (not talking here about Media translation) should remain in the database. That's why I don't understand why timeouts with Divi would continue.
Can you try a minimal environnement?
- Disable all your plugins. Check if Divi is working fine
- Reactivate WPML core + String translation. Does Divi works fine now?
- If so, please start reactivating the other plugins one by one, or activate them in small groups. This way you can verify at which point the issue appears again and identify the plugin that is causing the issue.

Please also enable WP_DEBUG to see if you have any PHP errors.
- Access your server via FTP and open wp-config.php (in your WordPress root directory).
- Insert those lines just before /* That's all, stop editing! Happy blogging. */

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );

Reproduce the issue, then access the debug log here: /wp-content/debug.log and copy paste the info in your next answer.
More info: https://wordpress.org/support/article/debugging-in-wordpress/

Nico

April 20, 2023 at 8:40 am #13509649

johnP-61

Hi Nico

Thanks for the support!

I have sorted the Divi issue - it turns out it was something to do with Cloudflare, rather than a WPML issue - seems very odd timing that nothing has changed in our Cloudflare for years but one of those things.

I'm not sure how to run that script I'm afraid - what do I need to do in order to execute that? My issue is now that even after running through the painstaking removal of the languages, then doing the reset of the WPML that I'm still left with the multiple entries in the media library, so do need that sorting before I start the process of reinstalling.

What I want to do is then install WPML slowly, and simply have it there to manage the multiple languages while we use Divi to edit the translations themselves. That way we don't need to worry about duplicating any images as we can just change them using the Divi editor that we're already used to.

Thank you for your patience in helping me with this.
John

April 20, 2023 at 5:24 pm #13513427

Nicolas V.
Supporter

Languages: English (English ) French (Français )

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

Hi John,

Ok, let me guide you step by step with an updated code:
1. Make sure you have a full backup of the site and database before proceeding
2. Add the following code to the functions.php file from your active theme

add_action('init', function() {
	if (isset($_GET['wpml_media_cleanup'])) {
		set_time_limit(0);
		global $wpdb;
		$ids_to_fix = $wpdb->get_results("SELECT element_id FROM {$wpdb->prefix}icl_translations WHERE element_type = 'post_attachment' AND source_language_code IS NOT NULL", ARRAY_A);
		if (!empty($ids_to_fix) && is_array($ids_to_fix)) {
			foreach ($ids_to_fix as $row_data) {
				if (!empty($row_data['element_id'])) {
					$wpdb->query($wpdb->prepare("DELETE FROM $wpdb->posts WHERE $wpdb->posts.ID = %d", $row_data['element_id']));
					$wpdb->query($wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE $wpdb->postmeta.post_id = %d", $row_data['element_id']));
				}
			}
			wp_die('Done!');
		} else {
			wp_die('No media translation found!');
		}
	}
});

3. Visit the site URL with wpml_media_cleanup in query string e.g. hidden link;

4. Use the "Remove ghost entries from the translation tables" from "WPML > Support > Troubleshooting (link)" or reset completely WPML once again.
Ref: https://wpml.org/documentation/support/wpml-troubleshooting-options/

Nico

April 21, 2023 at 8:28 am #13516241

johnP-61

Thanks Nico - I tried this on a development version of the site and simply received the message "no media translations found". I reinstalled WPML to see if that would make a difference and it didn't, and I've run through the remove ghost entries options again with no effect - there are still three sets of many items showing in the library.

I will see if I can manually find a way to remove those entries in the media library without affecting the live images on the site by filtering these to unattached items and those that have not been processed by our compression tool as that appears to display two of the three in most cases. I just hope that it doesn't pick up some of the other media files, but I'll run it in dev first.

One concern is whether there's anything else WPML may have left behind first time round, but I don't imagine there'll be much more we can do to check that given we've done the full resets etc.

I would then like to install WPML and make sure that there is no duplication in the media library so a few questions to try and avoid any other issues -

1) are there steps and options I need to check/uncheck as part of the install to make impact minimal and ensure no duplication in media library
2) given we would like to manage translated pages manually using the Divi page builder, can we still bulk duplicate pages in the first instance using WPML?

Translations themselves will be very very minimal at this stage - we are localising content in two more English language speaking countries to start with rather than mass-translating into other languages.

Hopefully we're getting there now!

Thanks again

John

April 21, 2023 at 9:14 am #13516567

johnP-61

My idea of removing the images manually didn't work - the site times out as there's too much to do at once. It will take a really long time to do this in any manual way in the numbers that the site will allow at once. Is there any other suggestions for how to remove all these entries?

April 21, 2023 at 6:06 pm #13519453

Nicolas V.
Supporter

Languages: English (English ) French (Français )

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

Hello John,

1. The code I provided will only work under specific circumstances:
- You had WPML installed and images were duplicated in different languages
- You deactivated WPML then all images are displayed in the media library (because they don't have a language anymore).
Again, We use the word "duplicate" but to be clear that WPML doesn't duplicate your files. I made this video to better explain point#1: hidden link

2. You can try to use a plugin such as https://wordpress.org/plugins/media-cleaner/ to clean up all unused images. Please note that it's not one of our plugins, so please test it before with a backup as we're not responsible.

3. You can check your database and see if WPML tables are still here, they start by icl_
If you did a proper reset they will be eliminated.

4. Yes you can duplicate your pages in bulk
https://wpml.org/documentation/translating-your-contents/displaying-untranslated-content-on-pages-in-secondary-languages/
Please read section "How to Duplicate Pages and Posts in Bulk" and if you want to make small adjustments for localization, then don't forget to click "Translate independently" before modifying the translation. But that's also explain in the documentation.

5. To translate manually and use the WordPress editor:
Ref: https://wpml.org/documentation/translating-your-contents/using-different-translation-editors-for-different-pages/

Nico

The topic ‘[Closed] Changing images on divi pages’ is closed to new replies.