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
- 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 -
- - - - - - -

Supporter timezone: Asia/Karachi (GMT+05:00)

Tagged: 

This topic contains 1 reply, has 0 voices.

Last updated by Waqas Bin Hasan 2 days, 15 hours ago.

Assisted by: Waqas Bin Hasan.

Author Posts
February 21, 2025 at 1:56 pm #16733908

scottJ-4

Background of the issue:
I am trying to display selected English translated posts in other translated languages. We can use Advanced Custom Fields to flag an English post that needs to be displayed in other languages, but the database query always seems to fall back to the current page language. We can't use 'use translation if available or fallback to default language' and filter out the posts that are set to display in all languages as this breaks the pagination.

Symptoms:
The database query always falls back to the current page language, and using the 'use translation if available or fallback to default language' option breaks pagination.

Questions:
How can I display selected English translated posts in other languages without breaking pagination?

February 24, 2025 at 7:55 am #16739216

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting the support.

As per my understanding, you want to include other translated posts in currently queried post (or translation of the queried post) in the display, which is not possible out of the box and isn't a WPML problem, because WPML is designed to translate the content into other languages and display the content based on the "current language".

You'll need a custom solution which is out of scope of this forum.

As a general idea, you need to switch the language on-the-fly to the desired one, query the intended post(s), grab the results, include in the display and switch back to the current language for rest of the process to continue with the standard flow.

WPML offers filters and action hooks that can be used in your WordPress theme or plugin to provide correct multilingual support. Browse following resources for more information:

- https://wpml.org/documentation/support/wpml-coding-api/
- https://wpml.org/documentation/support/wpml-coding-api/wpml-hooks-reference/
- https://wpml.org/documentation/support/wpml-coding-api/shortcodes/
- https://wpml.org/faq/how-to-get-current-language-with-wpml/

If you need additional custom work, we recommend you contact WPML Contractors at https://wpml.org/contractors/.

Regards.