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 is split from https://wpml.org/forums/topic/custom-post-types-posts-templates-and-contents-need-to-have-updated-twice/
This topic contains 10 replies, has 2 voices.
Last updated by Nigel 1 year, 8 months ago.
Assisted by: Nigel.
Author | Posts |
---|---|
September 7, 2023 at 9:25 am #14357637 | |
donO |
2. We have checked the media translation settings but still noticed that there are some project still missing media files in NL language. For an example, please check that the sliders are working in EN URL - But in NL, the slider and other media files are not loading at all. |
September 7, 2023 at 10:54 am #14358579 | |
Nigel WPML Supporter since 02/2016 Timezone: Europe/Madrid (GMT+02:00) |
I edited the Elementor template for single projects to see how the slider was added, and it is inserted with this shortcode if I have understood correctly: [mmk-project-slider key="project_gallery" bullet="dark"] Is that from some plugin, or is it something developed by yourselves? ("mmk" is similar to "mmek") Could I get some more information about that? I did spot some problems with missing images. Take this image, for example: hidden link There is an English attachment post for this image, with post ID 12904. I found that according to the WPML translation table there was a translation of this attachment post to Dutch, with post ID 14581. But when I checked wp_posts that post was missing. So I ran the WPML troubleshooting step to remove ghost entries from the translation table, and then I ran the scan again to add translations for existing media. And now there is a translation for the attachment post (ID 15605), which points to the same image file. So it should be available to work in the slider. But it isn't working, still, and so I would like more information about this shortcode that inserts the slider, so I can see how it works to know if it should handle the translations correctly. |
September 7, 2023 at 2:46 pm #14360803 | |
donO |
Hello Nigel, So the slider has been created using custom code and they are not coming from any other plugin. You will be able to see everything in the Hello theme child functions.php file. We have created a common slider engine which have many different skins depending on the page needs like, Also what are the changes you have made in the Single Project Template v1.0 as we have noticed that it's encountered a critical error if we click on edit project in NL language. Thanks |
September 8, 2023 at 3:15 am #14363365 | |
donO |
In addition to the last reply, we have been checking another project that has the slider in both languages and working correctly. hidden link So just wondering if the slider code has any issues, The aforementioned project slider should not work in both languages at the same time and point to the same images. Maybe you can find another different insight on this. At the same time, 2. If we want to upload images from scratch for the same project in other languages from the backend, what would be the best practices? Because if we try to do that, it will show locked from the regular editor from the Backend. Even now, we are having this error - Here you can see the error is telling it's coming from WPML. Please let us know if you have any other questions or figure out the issue. Kind Regards, |
September 8, 2023 at 1:59 pm #14367325 | |
Nigel WPML Supporter since 02/2016 Timezone: Europe/Madrid (GMT+02:00) |
I saw that trying to switch to the NL version of the Accenture project was giving a fatal error in the back end, and I could see that if I tried the same on my local copy of your site I found the same. I spent time tracing through what happens with the code and found an unexpected value for the project_gallery field being passed on the translated project, and I checked in the database and verified that the value stored was not of the format that is expected. So to fix that I simply updated the translation of the Accenture project from the EN original. I checked the database, and the project_gallery field had a value of the expected format, and—sure enough—I was then able to switch from the EN to the NL project in the back end without error. I did that on my local copy of your site first. Rather than wait for you to do the same on the production server I have done the same there, with the same result. It is possible to edit the project in Dutch in the back end, and when displaying the project on the front end the slider works in both languages. ("Works", but there is only one image saved in the project_gallery, so the gallery keeps rotating the same image, on both the EN and NL pages.) So, the slider was not working correctly because the single project template translation needed updating, and the accenture project wasn't working correctly because the project translation needed updating. Perhaps translation settings were changed after these translations were last updated and hence the change in the settings were not reflected in the translated template and post. I expect if there are similar issues with other projects or templates they could also be resolved by updating the translations with the current settings. Indeed, revisting the project you linked to at the top of this thread, it had the same problem as the Accenture project. I updated the translation for the project, and now it works correctly: hidden link So I think the sliders issue is "resolved" inasmuch as where the same problem occurs it can be resolved by updating the translation. Regarding your other questions: >1. We would like to know if we can create projects in different languages and then link them between translations easily. You mean, you would like to publish some projects in EN and translate those to NL, and you would like to publish some projects in NL and translate those to EN. Yes? You can do that. The only limitation would be that currently you could not use Automatic Translation from a secondary language to the default language, but that does not apply in your case because you are manually translating the content with WPML's Classic Translation Editor. >2. If we want to upload images from scratch for the same project in other languages from the backend, what would be the best practices? Your WPML media settings are to make new images available in all languages, so this should also be straightforward. If you are publishing a project first in NL and add images to that project, those images should automatically be added when you translate the project to English. You mention some errors but I don't know what you are referring to. Could you share some screenshots perhaps? |
September 12, 2023 at 10:32 am #14382783 | |
donO |
Hello Nigel, Thank you for your excellent co-operation and support so far. Kind Regards, |
September 12, 2023 at 10:44 am #14382829 | |
Nigel WPML Supporter since 02/2016 Timezone: Europe/Madrid (GMT+02:00) |
"translate the strong" Sorry, could you give me an example of what you mean? A screenshot, or share some code? |
September 13, 2023 at 5:50 pm #14392009 | |
donO |
Hello Nigel, Just wanted to let you know that we have created the slider codes before the decision of the Multilingual site. So now just wondering if it's possible to translate easily or we need to do some major coding or restructuring for this issue again. Your quick help would be highly appreciable. Kind Regards, |
September 14, 2023 at 7:48 am #14394269 | |
Nigel WPML Supporter since 02/2016 Timezone: Europe/Madrid (GMT+02:00) |
OK, that's fairly straightforward. Whenever you add texts in PHP files like that you need to prepare them for internationalization (known as "i18n" for short) using gettext calls. (This isn't specific to WPML.) We describe that in our documentation here: https://wpml.org/documentation/support/translating-the-theme-you-created/#using-gettext-functions-in-php So the line in your child theme from the screenshot that outputs the Learn more text would be wrapped in a __() function call, like so: <a href="<?php the_permalink(); ?>"> <?php __( 'Learn More', 'mmek-theme'); ?> </a> I used "mmek-theme" as the text-domain, as I don't think you are using a particular text-domain already. Then you can go to WPML > Theme & Plugins localization and scan your child theme so that WPML can find such texts and make them available for translation. You should then be able to go to WPML > String Translation and find the texts and translate them (you can filter by the text domain you used, e.g. "mmek-theme" if you use the same as my example above). |
September 25, 2023 at 5:34 am #14454349 | |
donO |
Hello Nigel, 1. Now we have noticed one more and probably the last issue with the translation. Whenever the below page loads with load more in ENG, it's loads projects in ENG mode. hidden link But whenever we are going to visit this in Dutch languages using the below URL, it has started with the Dutch projects but then as soon as more projects are loaded they are coming with ENG projects. hidden link 2. In addition to this, another weird duplication of projects happened under the Dutch concepting category there’s a weird duplicate of the projects and this doesn’t happen on the English version. Still this is not happening regularly. hidden link hidden link So can you please have a look at the issue and help us figure it out? Because we have been checking all the processes and really could not find any true reason why it could have been happened in such a strange way. Look forward to hearing from you at the earliest possible. Thanks, |
September 25, 2023 at 1:31 pm #14459059 | |
Nigel WPML Supporter since 02/2016 Timezone: Europe/Madrid (GMT+02:00) |
I'm not sure I can see the problem you describe in 1, but in any case it is almost certainly because you need to activate the setting for language cookies in support of ajax requests (screenshot). I have set that for you, so hopefully you should now get the expected behaviour on the Dutch page. Regarding the second issue, I'm not sure what I am supposed to be looking for. Both the English and Dutch versions of the project category archive for the concepting term look the same to me (apart from the language of the text), and in the back end the English and Dutch versions look largely the same. Can you clarify what the problem is? |
October 3, 2023 at 6:12 am #14501417 | |
donO |
Thank you for the wonderful support all through the process to fix some complicated issues. Now it's all good and stable. So we are good to close the ticket. Good luck! |