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
2 Answers
Reset to default 0you may use this below code for your problem: [1]: https://i.sstatic.net/5aX1D.pngor 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
版权声明:本文标题:localization - How do I override a parent theme's language files with a child theme? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736294935a1929463.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论