Skip Navigation

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

Problem:
I am trying to register a snippet from my functions.php as a string, but I can't get it to work. Here's the snippet:

function wc_custom_redirect_continue_shopping() {
return __('http://spikesandsparrow.com/shop/');
}
add_filter( 'woocommerce_continue_shopping_redirect', 'wc_custom_redirect_continue_shopping' );

How do I register the URL as a WPML string so that I can translate it with WPML?

Solution:
Solution here: https://wpml.org/forums/topic/register-a-snippet-as-string-for-wpml-translation/#post-2528336

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

Last updated by jeroenv-42 2 years, 2 months ago.

Assigned support staff: Noman.

Author Posts
July 15, 2018 at 8:42 pm #2527242

jeroenv-42

I am trying to register a snippet from my functions.php as a string, but I can't get it to work. Here's the snippet:

function wc_custom_redirect_continue_shopping() {
return __('<em><u>hidden link</u></em>');
}
add_filter( 'woocommerce_continue_shopping_redirect', 'wc_custom_redirect_continue_shopping' );

How do I register

<em><u>hidden link</u></em>

as a WPML string so that I can translate it with WPML?

July 16, 2018 at 2:47 pm #2528336

Noman
Supporter

Languages: English (English )

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

Hello Jeroenv,

Thank you for contacting WPML Support. I have wrap the string in the gettext functions __() with a text domain like 'themedomain’. Please use updated code:

function wc_custom_redirect_continue_shopping() {
return __('<em><u>hidden link</u></em>', 'themedomain');
}
add_filter( 'woocommerce_continue_shopping_redirect', 'wc_custom_redirect_continue_shopping' );

Then, scan the theme again in WPML >> Theme and plugins localization and translate this string under WPML >> String Translation

Thank you

July 16, 2018 at 4:27 pm #2528487

jeroenv-42

Thanks, Noman. Worked like a charm.