Skip to content Skip to sidebar

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 contains 5 replies, has 2 voices.

Last updated by nicolasD-26 4 years, 9 months ago.

Assisted by: Marcos Vinicios Barreto.

Author Posts
November 26, 2020 at 3:51 pm #7536217

nicolasD-26

Hello team :),

I need help with my custom theme for one of my clients.

I read this topic but I think I'm doing it wrong> https://wpml.org/forums/topic/using-custom-page-templates/

I have a front-page.php page which will look in one of my theme files /content/home-fr.php and home-en.php

When I duplicate the page for the EN version it does not save the template for the home-en.php

So I'm stuck and I can't translate the site.

Can you help me on that please?

Regards Nicolas

Capture d’écran 2020-11-26 à 16.49.28.png
Capture d’écran 2020-11-26 à 16.48.26.png
November 27, 2020 at 7:01 pm #7546551

Marcos Vinicios Barreto

Hello,

Thank you for contacting our support service. From the provided screenshot I see you are using a front-page.php template file, when doing so WordPress will render the homepage content using this template file. In the files contents it seems you are always getting the home-fr content no matter the language viewed. Although I can try to point you on the right direction, please note, to provide custom code is out the scope of our support service. I would recommend you to proceed this way:

1 - Instead of calling template parts in your front-page.php file, create a separed template for each language, for example page-template-en.php and page-template-fr.php.

2 - Then, manually adjust the pages in your WordPress Dashboard to render content either using the page-template-en or page-template-fr files.

3 - If you want to keep your current structure, please, make sure to look into our WPML API docs in order to understand how to load a different file according the language viewed.

See:

https://wpml.org/documentation/support/achieving-wpml-compatibility-for-your-themes-and-plugins/

https://wpml.org/documentation/support/wpml-coding-api/

https://wpml.org/documentation/support/

As said, while we are happy in providing you with the directions above, we are not able to provide you a custom solution or to provide a fix for your code. For this kind of request, we recommend you to consider one of our WPML contractors at: https://wpml.org/contractors/

Hope it brings some clarifications on how to proceed. Thank you for your understanding, have a nice day.

November 29, 2020 at 6:59 am #7552049

nicolasD-26

Hello Marcos,

Thank you for your answer.

So if I understand correctly my front-page must call either page-template-en.php or page-template-fr.php

That's right ?

I try to do this as soon as possible and get back to you.

thank you for your help

November 30, 2020 at 5:06 pm #7562685

nicolasD-26

Hello Marcos,

My problem is solved.

Something else: I'm trying to translate a field in an overlay that I created for my client's contact page (see PJ)

Except that I see that WPML cannot write in the file (I requested correction to the host but for the moment it does not work)

Is this what causes the concern of front translation?

Best regards

Capture d’écran 2020-11-30 à 18.04.13.png
November 30, 2020 at 11:12 pm #7564539

Marcos Vinicios Barreto

Hello,

Thank you for the updates. As this is a different issue regarding the String Translation, I would recommend you to read our docs regarding it at:

https://wpml.org/documentation/getting-started-guide/string-translation/

https://wpml.org/documentation/getting-started-guide/string-translation/finding-strings-that-dont-appear-on-the-string-translation-page/

I case it doesn't help to solve your issue, I kindly ask you to create a new ticket as per our support policies we are only able to handle one subject/issue per ticket, the reason for that is to make it easier for our customers to find solutions for their issues on a topic basis.

Thank you for your understanding and collaboration, have a nice day.