String translation in child theme
-
Hello, this is my first time asking a question here so please don’t mind if I don’t do it the correct way.
My question:
I want to translate custom strings in my child theme using Poedit. I have been reading a lot of questions on forums and trying a lot, but I just can’t make it work.
Till now what I have done:– Add this code to my child functions.php:
function oceanwp_child_setup() { $path = get_stylesheet_directory().'/languages'; load_child_theme_textdomain( 'oceanwp', $path ); } add_action( 'after_setup_theme', 'oceanwp_child_setup' );
– Creating a /languages folder in my child theme;
– Extracting the strings from my child theme using Poedit;
– Translating the strings in Poedit and saving them in /languages (.po & .mo);
____
This above did not work, so I tried using a different text-domain for the child theme but that also did not work.One of the strings I want to translate is
esc_html__( 'Custom Menu', 'oceanwp' )
I tried renaming the /languages folder in the main theme, copying all the files to the child theme /languages and the translation of the main theme strings were all working. I think that the main theme language is overriding the child theme.
So now I’m really desperate and you guys are my only hope left :(.
Any help will be much appreciated.
Thank you!
- The topic ‘String translation in child theme’ is closed to new replies.