把程式碼也分享出來吧,方便其他使用者自定義:載入子主題中的檔案
為此,請編輯 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 子主題已經新增了此程式碼,請勿反覆新增。