强大、实用的Redux框架我们已经在WordPress强大的开源后台框架Redux Framework介绍与使用一文中介绍了,今天我们介绍下如何对后台选项面板中的内容进行翻译。
官网给出的集成redux到主题中的代码:
if ( !class_exists( 'ReduxFramework' ) && file_exists( dirname( __FILE__ ) . '/admin/ReduxCore/framework.php' ) ) {
require_once( dirname( __FILE__ ) . '/admin/ReduxCore/framework.php' );
}
if ( !isset( $redux_demo ) && file_exists( dirname( __FILE__ ) . '/admin/config.php' ) ) {
require_once( dirname( __FILE__ ) . '/admin/config.php' );
}
加载语言包的代码:
//加载语言包
load_theme_textdomain('salong', get_template_directory() . '/languages');
而通过这两段代码,对语言包进行翻译,主题选项中会出现没有生效的情况,其实这是个相当简单但是一般不会想到的问题。
解决方法:
就是把第二段加载语言包的代码添加到调用主题选项代码的前面,也是没有想到,谷歌找了很多都没有解决,最后还是看到插件的作者说才成功了。

