Created
April 7, 2017 08:12
-
-
Save kirandash/b8201151db106975e083c0a4dcbd2780 to your computer and use it in GitHub Desktop.
WPML get translated content of a string from all languages if available
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| global $sitepress; | |
| // save current language | |
| $current_lang = $sitepress->get_current_language(); | |
| //set your language | |
| $my_lang = 'es'; | |
| //switch to defined language | |
| $sitepress->switch_lang($my_lang); | |
| // display string | |
| icl_t($context, $name); | |
| // switch back to the default | |
| $sitepress->switch_lang($current_lang); | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment