load_child_theme_textdomain

函式
load_child_theme_textdomain ( $domain, $path = false )
引數
  • (string) $domain Text domain. Unique identifier for retrieving translated strings.
    Required:
  • (string|false) $path Optional. Path to the directory containing the .mo file. Default false.
    Required:
    Default: false
返回值
  • (bool) True when the theme textdomain is successfully loaded, false otherwise.
定義位置
相關方法
load_theme_textdomainload_script_textdomainload_default_textdomainload_textdomainload_plugin_textdomain
引入
2.9.0
棄用
-

load_child_theme_textdomain: 這是WordPress中的一個函式,用於載入一個子主題的翻譯檔案。你可以使用這個函式來翻譯你的子主題的模板檔案和其他PHP程式碼中的字串。

載入子主題的翻譯字串。

如果當前的locale在子主題根目錄下以.mo檔案的形式存在,它將被$domain包含在翻譯後的字串中。

.mo檔案必須準確地根據區域設定來命名。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function load_child_theme_textdomain( $domain, $path = false ) {
if ( ! $path ) {
$path = get_stylesheet_directory();
}
return load_theme_textdomain( $domain, $path );
}
function load_child_theme_textdomain( $domain, $path = false ) { if ( ! $path ) { $path = get_stylesheet_directory(); } return load_theme_textdomain( $domain, $path ); }
function load_child_theme_textdomain( $domain, $path = false ) {
	if ( ! $path ) {
		$path = get_stylesheet_directory();
	}
	return load_theme_textdomain( $domain, $path );
}

常見問題

FAQs
檢視更多 >