Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php &引用__(“自定义邮件类型中的”_Php_Wordpress - Fatal编程技术网

Php &引用__(“自定义邮件类型中的”

Php &引用__(“自定义邮件类型中的”,php,wordpress,Php,Wordpress,我正在为一个wordpress项目构建我的自定义帖子类型,但我不明白为什么在互联网上的一些示例中可以找到这样的内容: register_post_type('omb_prodotti', array( 'labels' => array( 'name' => __( 'customposttype' ), 'singular_name' => __( 'customposttype' ) ) “u uuuuuuu

我正在为一个wordpress项目构建我的自定义帖子类型,但我不明白为什么在互联网上的一些示例中可以找到这样的内容:

register_post_type('omb_prodotti',
    array(
      'labels' => array(
        'name' => __( 'customposttype' ),
        'singular_name' => __( 'customposttype' )
      )
“u uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu

register_post_type('omb_prodotti',
    array(
      'labels' => array(
        'name' => 'customposttype',
        'singular_name' => 'customposttype'
      )
抱歉,我是PHP和构建自定义WP主题的初学者


非常感谢。

不可能在搜索引擎中搜索
\uuuu
,但使用
wordpress双下划线
我在wordpress文档中找到了答案:

描述 从translate()中检索已翻译的字符串

用法


正如您所写的,这是一个用于翻译内容的函数。关于您的问题,如果您不调用
\uuuuu()
函数,字符串将不会被翻译,它将只显示
customposttype
。使用
\uuuuuu('customposttype'))
,它将加载翻译,这可能是一个相关的字符串。您必须查看代码才能找到相应的字符串。

如果您在WP文档中准确搜索此字符串,您可能很难找到它-除非您知道它的用途,这就是

在那里,您将发现此函数用于国际化(也称为i18n),或将字符串翻译成其他语言

这取决于你将使用你的代码做什么——如果它不是你将分发给其他人使用的东西,那么你真的不需要担心它

然而,如果它是一个插件,你将发布和其他人将使用,那么你实际上需要了解如何使用它

WP中有四个函数可以实现这一点:

// Returns the translated string
__('My String to Translate', 'mytextdomain');

// Echos the translated string
_e('My String to Translate', 'mytextdomain');

// Returns the translated string, using different translations based on "domain"
_x('My String to Translate', 'mytextdomain', 'domain');

// Echos the translated string, using different translations based on "domain"

_ex('My String to Translate', 'mytextdomain');
请注意,翻译不是“自动的”——它是从主题或插件提供的文件中读取的(必须有人手动创建/翻译这些字符串)


这篇文章很有用:

@cale_b谢谢,我收回了最后一票:)