S
S
Sasha Ulych2015-11-04 00:03:51
WordPress
Sasha Ulych, 2015-11-04 00:03:51

How to include translation files in wordpress theme?

I use a purchased theme, it has a languages ​​folder. I added translations in my "child theme", but the translations do not change. Maybe there is some function for this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman, 2015-11-04
@llgruff

Set correct language in wp-config.php:
Copy all language files to child theme folder:
Add to child theme's functions.php:

add_action( 'after_setup_theme', 'my_child_theme_setup' );
function my_child_theme_setup(){
  load_child_theme_textdomain( '$domain', get_stylesheet_directory() . '/languages' );
}

where $domain is a unique identifier by which in the translation functions: __() _e() it will be possible to refer to this particular translation string. You can specify the same as the parent theme.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question