Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client is using Elementor Pro and WPML to manage a multilingual site with a custom post type (CPT) called 'Chargers.' They need to apply two templates: Template A as the default and Template B with SEO blocks only for certain chargers in German. However, Template B is displaying for all languages instead of just German.
Solution:
We recommend creating separate templates for each language. Here are the steps to follow:
1. Set Template A for all chargers excluding the specific ones intended for Template B, ensuring it works in the default language without WPML.
2. Apply Template B only to the specific chargers intended, and verify it functions correctly.
3. For languages other than German, recreate Template B to mimic Template A, and for German, maintain the SEO blocks as desired.
For further guidance on managing templates with different languages, we suggest checking out this documentation: Using Different Translation Editors for Different Pages.

If this solution does not apply to your case, or if it seems outdated, please open a new support ticket. We also highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. For further assistance, visit our support forum at WPML Support Forum.

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.

Tagged: 

This topic contains 0 replies, has 0 voices.

Last updated by Dražen Duvnjak 2 weeks, 5 days ago.

Assisted by: Dražen Duvnjak.

Author Posts
November 11, 2024 at 11:19 am #16388109

markG-39

Background of the issue:
We’re using Elementor Pro and WPML to manage a multilingual site with a custom post type (CPT) called 'Chargers.' We need to apply two templates to this CPT with specific display logic: Template A is the standard template without SEO blocks, and should be the default for all chargers in all languages. Template B is a secondary template with SEO blocks, which we want to display only for certain chargers in German. All other chargers and languages should continue to use Template A. We have set Template B’s display conditions in Elementor Pro to target specific chargers based on post ID, but Elementor’s conditions don’t allow us to restrict this by language. Our templates are set as translatable independently in WPML, but this hasn’t resolved the language-specific targeting issue. ACF fields correctly display language-specific content for German, but Template B is incorrectly displayed for all languages.

Symptoms:
When we set Template B to apply only to specific chargers, it ends up displaying across all languages instead of being limited to German.

Questions:
Could you please advise on any WPML-compatible solutions or recommended workarounds to achieve this selective template display by both language and specific post?

November 11, 2024 at 11:55 am #16388343

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

I have created a ticket, let me know when done and how I can see the issue and I will check it out.

Regards,
Drazen

November 11, 2024 at 12:06 pm #16388398

markG-39

So I have set things up on the sandbox.

The current behaviour is that I set up template B for Charger B. Even though I have set up the template condition only on the DE Version of the template B - it shows the Template B for all languages for that post type.

What I am trying to achieve, is that Template B is only shown when we are on Charger B in German, EN and ES should show template A.

I hope this makes more sense now 🙂 Additionally, this is not the same behaviour that I have on my staging site. To use this example on the sandbox, currently, setting things up the same results in Template B being shown for all German posts... Something strange is going on here - thanks in advance for your help!

November 11, 2024 at 12:16 pm #16388481

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

I have checked and I think this wont work like this, you need to have templates per posts / CPT, not by posts+language.

So what I suggest is next:

- Set template A for all posts excluding charger B, make sure this works in the default language, without WPML
- Set template B to be applied only for Charger B, make sure it works fine

The suggestion here is, to create different template for languages. So in EN, for Template B, re-create a design that looks like Tempalate A, and for German create that it looks like Template B etc.

A document that might be useful:

- https://wpml.org/documentation/translating-your-contents/using-different-translation-editors-for-different-pages/#how-to-use-manual-translation

Hope this helps.

Regards,
Drazen

November 11, 2024 at 12:18 pm #16388485

markG-39

Template B was not translated - fixed this now.

November 11, 2024 at 12:31 pm #16388507

markG-39

OK I think I understand.

Within Template B, I will leave the style for Template B for the specific Langauge (in this case German) and for the Other languages, I will use the layout for Template A within Template B.

In this logic, we would always show Template B on the Charger B, but the layout will match Template A when ES or EN are selected.

I will test this on the sandbox and let you know if I have any issues. Thanks!

November 11, 2024 at 12:43 pm #16388571

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

yes, correct. It should work just fine.

Regards,
Drazen