把代碼也分享出來吧,方便其他用户自定義:加載子主題中的文件
為此,請編輯 functions.php
也就您的子主題並將此 PHP 代碼放入其中:
/*================================================
#Load the translations from the child theme folder
================================================*/
function wpdivi_translation() {
load_child_theme_textdomain( 'Divi', get_stylesheet_directory() . '/lang/theme/' );
load_child_theme_textdomain( 'et_builder', get_stylesheet_directory() . '/lang/builder/' );
}
add_action( 'after_setup_theme', 'wpdivi_translation' );
然後再按照樓上的圖創建 lang
文件夾,然後再新建兩個子文件夾 theme
和 builder
這樣 divi 就可以自動識別子主題裏面的語言包文件。
注意:薇曉朵 divi 子主題已經添加了此代碼,請勿反覆添加。