admin管理员组

文章数量:1122832

I have a parent theme and a child theme, I would like to override the spanish .mo and .po files in the parent theme (or add them if they are not present in the parent theme) with the es_ES ones in my child theme. I added the folder with the modified mo and po files in the child theme with the same folder name as in the parent theme but this is not working. How can I come about this? Thanks!

I have a parent theme and a child theme, I would like to override the spanish .mo and .po files in the parent theme (or add them if they are not present in the parent theme) with the es_ES ones in my child theme. I added the folder with the modified mo and po files in the child theme with the same folder name as in the parent theme but this is not working. How can I come about this? Thanks!

Share Improve this question asked Apr 10, 2013 at 19:08 lilireedlilireed 411 silver badge2 bronze badges 1
  • 3 This is specifically covered in the codex. – vancoder Commented Apr 10, 2013 at 23:15
Add a comment  | 

2 Answers 2

Reset to default 0
you may use this below code for your problem:

  [1]: https://i.sstatic.net/5aX1D.png
or use below code:
add_action( 'after_setup_theme', function () 
{

    load_theme_textdomain( 'your parent theme name', get_stylesheet_directory() . '/languages/' );

    load_child_theme_textdomain( 'your child theme name', get_stylesheet_directory() . '/languages' );
} );

If you want to change more than just the stylesheet, your child theme can override any file in the parent theme: simply include a file of the same name in the child theme directory, and it will override the equivalent file in the parent theme directory when your site loads. For instance, if you want to change the PHP code for the site header, you can include a header.php in your child theme's directory, and that file will be used instead of the parent theme's header.php.

You can also include files in the child theme that are not included in the parent theme. For instance, you might want to create a more specific template than is found in your parent theme, such as a template for a specific page or category archive. See the Template Hierarchy for more information about how WordPress decides what template to use.

本文标签: localizationHow do I override a parent theme39s language files with a child theme