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/unable-to-translate-the-specified-page-with-cpt/
Tagged: Custom Work
This topic contains 0 replies, has 1 voice.
Last updated by Long Nguyen 16 hours, 15 minutes ago.
Assisted by: Long Nguyen.
Author | Posts |
---|---|
November 18, 2024 at 1:20 am #16412390 | |
nicholasC-18 |
Hi Nguyen, Thanks for your suggestions. Yes, the page can now be translated but the translated regions, countries and ports are still cannot be displayed. Looking forward to your reply. |
November 18, 2024 at 1:34 am #16412395 | |
Long Nguyen Supporter
Languages: English (English ) Timezone: Asia/Ho_Chi_Minh (GMT+07:00) |
Hi Nicholas, Here is the new ticket. I see that you are using the Elementor Custom HTML widget to show the countries (posts) in the accordion section. Looking forward to your reply. |
November 25, 2024 at 7:28 am #16437981 | |
nicholasC-18 |
Hi Nguyen, Sorry for the late reply, just came back and tried the "wpml_object_id" filter. Unfortunately it still doesn't work properly. Could you please go into our WordPress CMS and check? Thank you |
November 25, 2024 at 7:44 am #16438015 | |
Long Nguyen Supporter
Languages: English (English ) Timezone: Asia/Ho_Chi_Minh (GMT+07:00) |
Hi, I would like to request temporary access (wp-admin and FTP) to your site so I can take a better look at the issue. It would be better to have a testing site where the issue is replicated. Your next reply is set to private to share the info. ❌ IMPORTANT: Please backup your database and website before proceeding ❌ Looking forward to your reply. |
November 26, 2024 at 1:34 am #16442334 | |
Long Nguyen Supporter
Languages: English (English ) Timezone: Asia/Ho_Chi_Minh (GMT+07:00) |
Hi, Can you please share the server protection account? Your next reply is set to private to share the info. Also, if you are using Ajax to load the data, I suggest you follow the documentation to pass the current language to the callback function and switch the language there to get the correct translation post. Looking forward to your reply. |
November 27, 2024 at 1:41 am #16447210 | |
Long Nguyen Supporter
Languages: English (English ) Timezone: Asia/Ho_Chi_Minh (GMT+07:00) |
Hi, Now I see the countries, ports ... are displayed on the translation page, so I think this issue is resolved, see the attached screenshot. Also note that, this is completely a custom code. I would like to inform you that helping you with custom code, is out of the scope of WPML, but I helped you by pointing you to the source of the problem you are having. Thanks. |
November 27, 2024 at 9:20 am #16448228 | |
nicholasC-18 |
Hi Nguyen, I think there is a misunderstanding between us, let me describe the problem again. On the Chinese page, the regions and countries can be displayed, but it is still displayed in English. So my question is why the translated regions and countries cannot be displayed in Chinese. Please refer to the attached screenshots. Thank you. |
November 28, 2024 at 3:38 am #16452221 | |
Long Nguyen Supporter
Languages: English (English ) Timezone: Asia/Ho_Chi_Minh (GMT+07:00) |
Hi, I can show the tranlsation countries on the translation page, here are some steps that I've done on your staging site: 1. Edit the snippet "Enqueue Styles & Scripts", add the following code to localize the current language: // Get the current WPML language $current_language = apply_filters( 'wpml_current_language', null ); // Localize the script with the current language wp_localize_script( 'common-js', 'wpmlData', array( 'currentLanguage' => $current_language, )); 2. Edit the file /wp-content/themes/hello-theme-child-master/theme/default/js/pil-ajax.js, lang: typeof ICL_LANGUAGE_CODE !== 'undefined' ? ICL_LANGUAGE_CODE : 'en' with this one to pass the current language code to the callback function: lang: wpmlData.currentLanguage 3. Edit the snippet "LOCAL OFFICES - Map & Accordion", move the query that fetches countries inside the function wp_locations_json() and use the post ID instead of the translation post ID because you have already switched the language to the Chinese language. Please notice that, this is the custom code and beyond our scope of support. The steps above are just the sample code to show how it works. If you cannot accomplish this, I recommend you contact one of our certified partners who will be more than happy to help you with this. In this link, you will find a list of our certified partners: https://wpml.org/contractors/ Thanks for your understanding and patience. |