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.

This topic contains 1 reply, has 2 voices.

Last updated by Mohamed Sayed 1 year, 1 month ago.

Assisted by: Mohamed Sayed.

Author Posts
November 22, 2023 at 8:34 am #14893677

Rene

Tell us what you are trying to do?

I am trying to find strings from some custom php code I added. It displays one sentence for visitors who are not logged in. One part of that sentence is also styled as a button. How can I find the string(s) of this custom code and translate it to English and German. Is this even possible or do I have to solve this in another way?

What is the link to your site?

Here you can see the sentence + button that I want to translate to the other two languages:
hidden link

November 22, 2023 at 5:12 pm #14901393

Mohamed Sayed

Hi Rene,
Thanks for contacting WPML support.

Unfortunately, we do not provide support for custom coding. Kindly check our support policy. (https://wpml.org/purchase/support-policy/)

However, I will try to point you in the right direction. In order to make the strings added with custom code translatable, the following conditions have to be met:

- The string must be wrapped in gettext calls.
- There must be a textdomain argument.

For example, if your code is:

<h2>Some text</h2>

It should be changed to:

<h2><?php _e( 'Some text', 'my-textdomain' ); ?></h2>

Then you will be able to translate it via String Translation. Please check this guide for more details: https://wpml.org/documentation/support/enabling-text-translation-for-themes-not-compatible-with-wpml/

Kind regards,
Mohamed