wickywills
12/18/2018 - 2:03 PM

Wordpress translation for child theme

Step 1: Add languages directory to your theme

Step 2: Download correct .mo file into the languages directory you created

Step 3: Generate .po file from the .mo file using PoEdit

Step 4 (if using child theme): Add in the following to your functions.php file, changing the name for the parent theme:

// Load translation files from your child theme instead of the parent theme
function my_child_theme_locale() {
    load_child_theme_textdomain( 'YOUR-PARENT-THEME', get_stylesheet_directory() . '/languages' );
}
add_action( 'after_setup_theme', 'my_child_theme_locale' );