Support » Everything else WordPress » How to translate, internationalize functions.php file in Child Theme?And should

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    If you are sure you did everything in the doc you linked, a likely place for a blunder is getting the path to your .mo files wrong. The example in the doc to load text domain is misleading if you use a child theme. You should be calling load_child_theme_textdomain(). And the correct child theme path is obtained from get_stylesheet_directory(). For example:

    function wpdocs_child_theme_setup() {
        load_child_theme_textdomain( 'my_child_theme', get_stylesheet_directory() . '/languages' );
    }
    add_action( 'after_setup_theme', 'wpdocs_child_theme_setup' );

    Your .mo files need to be with your child theme in the /languages subfolder.

    Thread Starter Gregosz

    (@gregosz)

    Thank you very much for the hint. I did as you advised and everything works as it should! ๐Ÿ™‚
    Grzegorz

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.