Make sure to have WordPress and WPML installed
Get The Best WordPress Hosting and WPML Support for free here
1- Register your localized string name inside functions.php
if ( ! function_exists( 'wpex_icl_register_strings' ) ) {
function wpex_icl_register_strings() {
// Return if function doesn't exist
if ( ! function_exists( 'icl_register_string' ) ) {
return;
}
// Array of strings
$strings = array(
'gbe_seach_descx' => "this is a text",
);
// Register strings
foreach( $strings as $string => $default ) {
print_r( $strings );
icl_register_string ( 'greenbackend', $string, $default) ;
//icl_unregister_string ( 'greenbackend', $string) ;
}
}
}
add_action( 'admin_init', 'wpex_icl_register_strings' );
2-you can see it here
3-translate its language content
4-call it
icl_t('greenbackend', 'gbe_seach_descx', 'this is a text')
the first argument greenbackend: domain
the second argument is the key or the name
the last one is the original value in the defaul language and can be translated in step 3
Get The Best WordPress Hosting and WPML Support for free here
Leave a Reply