load_child_theme_textdomain()
load_child_theme_textdomain( string $domain, string $path = false )
加载子主题转换字符串。
Load the child themes translated strings.
说明(Description)
如果当前区域设置作为.mo文件存在于子主题根目录中,则$domain会将其包含在翻译的字符串中。
.mo文件的命名必须完全基于区域设置。
参数(Parameters)
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
$domain | (string) | 必需 | 文本域。检索转换字符串的唯一标识符。 |
$path | (string) | 可选 | 包含.mo文件的目录的路径。 |
返回(Return)
(bool)成功加载主题textdomain时为True,否则为false。
源码(Source)
更新版本 | 源码位置 | 使用 | 被使用 |
---|---|---|---|
2.9.0 | wp-includes/l10n.php:910 | 0 | 2 |
笔记(Notes)
load_child_theme_textdomain()函数通常应该从after_setup_theme操作挂钩中调用,与其相关的load_theme_textdomain()函数相同。
对于初学者来说,也可以在上面的注释中知道
load_child_theme_textdomain() 为WP2原创文章,链接:https://www.wp2.cn/functions/load_child_theme_textdomain/