Activate Child Theme .mo and .po files

I am experiencing some problems while trying to use my dutch .mo and .po files for my child theme.

I have added the following line to wp-config.php:

Read More
define ('WPLANG', 'nl_NL');

After that I have placed the .mo and .po files in: child-theme/languages/. Lastly I followed a post here on stack exchange and pasted this code in my child theme’s functions.php:

add_action('after_setup_theme','wpse_110727_translate_theme');
function wpse_110727_translate_theme() {
     load_theme_textdomain( 'textdomain', get_template_directory() . '/languages' );
     $locale = get_locale();
     $locale_file = get_template_directory() . "/languages/$locale.php";

         if ( is_readable( $locale_file ) ) require_once( $locale_file );
 }

After all this, my translation still isn’t active on my pages.

Related posts

1 comment

  1. I don’t have a TON of experience loading in text-domains, but I think the problem could be as simple as get_template_directory().

    get_template_directory() returns the parent directory, while get_stylesheet_directory() returns the child theme directory.

Comments are closed.