Translate a Wordpress theme
There is plenty of tutorial on how to translate a thème with creating a .po & .mo files. I will not create another one here, just check this one : http://www.appthemes.com/blog/how-to-translate-a-wordpress-theme/
But if you want to implement this translation in a brand new theme or i a theme which not support translation out of the box you'll need more than that.
Here is how to implement this:
Edit your functions.php
file and add this small piece of code
function langage() {
load_theme_textdomain( 'my_theme', get_template_directory() . '/languages' );
}
add_action( 'after_setup_theme', 'so16309230_after_setup_theme' );
Then make sure that your style.css
files contains the text domain declaration
Text Domain: my_theme
Refresh your site and you will the magic happens, front-end & back-end side !
Enjoy
Written by Xavier COIFFARD
Related protips
1 Response
Your code should say
addaction( 'aftersetup_theme', 'language' );
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Translation
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#