1

I am creating a series of WP child themes which are dependent of a parent theme which I will be using as a framework.

I need to have these themes (both parent and children) localized.

from http://codex.wordpress.org/Function_Reference/load_theme_textdomain I understood I need to add the following to my theme:

add_action('after_setup_theme', 'my_theme_setup');
function my_theme_setup(){
    load_theme_textdomain('mytextdomain', get_template_directory() . '/lang');
}

this goes in the functions.php, I suppose

however, what about children themes? functions.php of a children theme overrides functions.php of a parent theme

should textdomain ("mytextdomain") of the child theme be the same as parent theme or be different (and also call load_theme_textdomain function with a different function name (see above code "my_theme_Setup()")?

what is the correct way of localizing both a parent and child theme?

thank you for clarifying this :)

1
  • The functions.php of a child does not "override" the parent, it gets loaded before the parent's functions.php file loads. BOTH functions.php files will be loaded by WordPress.
    – Otto
    Sep 11 '12 at 20:04
3

Child themes should use load_child_theme_textdomain(). You can find it in /wp-includes/l10n.php. Use a new slug and a separate po file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.