Skip to content

Instantly share code, notes, and snippets.

@nmedia82
Created March 16, 2017 12:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nmedia82/c01f46210c4d43b0fd35aab7a1c327eb to your computer and use it in GitHub Desktop.
Save nmedia82/c01f46210c4d43b0fd35aab7a1c327eb to your computer and use it in GitHub Desktop.
N-Media Helper Functions File
/**
* WPML
* registering and translating strings input by users
*/
if( ! function_exists('nm_wpml_register') ) {
function nm_wpml_register($field_value, $domain) {
$field_name = $domain . ' - ' . sanitize_key($field_value);
//WMPL
/**
* register strings for translation
* source: https://wpml.org/wpml-hook/wpml_register_single_string/
*/
do_action( 'wpml_register_single_string', $domain, $field_name, $field_value );
//WMPL
}
}
if( ! function_exists('nm_wpml_translate') ) {
function nm_wpml_translate($field_value, $domain) {
$field_name = $domain . ' - ' . sanitize_key($field_value);
//WMPL
/**
* register strings for translation
* source: https://wpml.org/wpml-hook/wpml_translate_single_string/
*/
return apply_filters('wpml_translate_single_string', $field_value, $domain, $field_name );
//WMPL
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment