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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Europe/Kyiv (GMT+02:00)

Tagged: 

This topic contains 3 replies, has 0 voices.

Last updated by Andrey 4 days, 8 hours ago.

Assisted by: Andrey.

Author Posts
February 9, 2026 at 4:26 pm #17806295

rhondaF

I'd like to translate certain text at the theme level such as 'Related Issues' and 'Related Content' on a page like hidden link. I followed hidden link
but interested to do this via code because I have numerous sites using the same theme. Could you provide details on how this can be accomplished? I looked into this thread https://wordpress.stackexchange.com/questions/127917/generating-po-mo-translating-files-from-scratch-in-a-wordpress-theme/320250#320250 but not sure if I should follow this approach.

February 9, 2026 at 6:49 pm #17806708

Andrey
WPML Supporter since 06/2013

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+02:00)

Thank you for contacting WPML support.

Do you know how the 'Related Issues' and 'Related Content' text is added to the page? Are you able to locate this with your current theme files? If so, could you please share the relevant code?

I've enabled debug information for this support ticket. Please refer to this link for instructions on how to retrieve this information from your site and provide it to us: http://wpml.org/faq/provide-debug-information-faster-support/

February 12, 2026 at 1:02 am #17814594

rhondaF

Here's some related code:

array(
heading' => __( 'Related Chapters', 'aclu-affiliate' ),
'cards' => $related_cards,
'columns' => 2,
)

here's another:

get_template_part(
'global/template-parts/organisms/components/cards--latest-content/controller/cards--latest-content--controller',
null,
array(
'heading' => __( 'Related Content' ),
'description' => false,

We're aiming to do this without using wpml string translations plugin if possible.

February 12, 2026 at 7:41 pm #17818692

Andrey
WPML Supporter since 06/2013

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+02:00)

Thank you for your feedback.

To make your text translatable, you need to wrap all static texts in gettext calls (e.g., __(), _e(), etc.). After that, go to WPML → Theme and plugins localization and scan your child theme for new strings. This will register them in WPML’s String Translation, where you can provide translations.

hidden link

Adding GetText Calls to PHP Code

In PHP, wrap all the hard-coded strings in gettext WordPress localization functions like __() and _e(). Specify a text domain to uniquely identify translations for your theme or plugin.

The __() function returns the strings

__('Hello, world!', 'your-text-domain');

The _e() function echoes a translatable string

_e('Hello, world!', 'your-text-domain');

These functions find the correct translation in the specified locale and domain. If no translation is available, the original string will remain unchanged.

Scanning a Theme or Plugin to Update Existing Translations:
https://wpml.org/documentation/getting-started-guide/string-translation/finding-strings-that-dont-appear-on-the-string-translation-page/#scan-theme-or-plugin-to-update-translations

Let's look at the examples you shared:

- This one looks correct __( 'Related Chapters', 'aclu-affiliate' ), but you need to make sure that aclu-affiliate textdomain is loaded correctly.

array(
heading' => __( 'Related Chapters', 'aclu-affiliate' ),
'cards' => $related_cards,
'columns' => 2,
)

- This example has a missing textdomain __( 'Related Content' ), it should be as in the example above.

get_template_part(
'global/template-parts/organisms/components/cards--latest-content/controller/cards--latest-content--controller',
null,
array(
'heading' => __( 'Related Content' ),
'description' => false,

How to properly load the text domain?

For more information, please refer to these links:

https://developer.wordpress.org/reference/functions/load_theme_textdomain/

https://developer.wordpress.org/themes/functionality/internationalization/#text-domain

Before proceeding with any updates, please remember to back up your database first.