Last active
August 1, 2021 09:47
-
-
Save abelsaad/5fc5eb236174b053b5773b3fc6f05163 to your computer and use it in GitHub Desktop.
Polylang: Translate custom strings
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
You must first register the strings for translation. | |
For example you echo "Hello world" in some template file like this: | |
<?php pll_e('Hello world'); ?> | |
To show string in the "Strings translation" add in your functions.php: | |
<?php | |
add_action('init', function() { | |
pll_register_string('mytheme-hello', 'Hello world'); | |
}); | |
?> | |
Add all custom strings you want to translate to this function. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment