admin管理员组文章数量:1430970
Sorry for this novice question. I'd like to know why WordPress themes add their theme names many occasions in PHP files (e.g. where 'twentynineteen' is repeated below, this is from functions.php in twentynineteen theme). Looks like themes can function fine without those names included, though.
register_nav_menus(
array(
'menu-1' => __( 'Primary', 'twentynineteen' ),
'footer' => __( 'Footer Menu', 'twentynineteen' ),
'social' => __( 'Social Links Menu', 'twentynineteen' ),
)
);
Is there any particular reason why theme names are included? Thank you in advance for your advice!
Sorry for this novice question. I'd like to know why WordPress themes add their theme names many occasions in PHP files (e.g. where 'twentynineteen' is repeated below, this is from functions.php in twentynineteen theme). Looks like themes can function fine without those names included, though.
register_nav_menus(
array(
'menu-1' => __( 'Primary', 'twentynineteen' ),
'footer' => __( 'Footer Menu', 'twentynineteen' ),
'social' => __( 'Social Links Menu', 'twentynineteen' ),
)
);
Is there any particular reason why theme names are included? Thank you in advance for your advice!
Share Improve this question asked Apr 20, 2019 at 8:06 JoeyJoey 235 bronze badges1 Answer
Reset to default 2The name you see is the text domain of the theme. __('some text', 'text-domain')
is a translation function, which makes it possible to translate the some text
into different languages. There are also other translation functions that can be used in different situations. You can learn more about translations on the codex, I18n
P.s. if the text domain is left out, the function uses default WP text domain and tries to find translations from that. For example simple strings, like yes and no, usually gets translated from the default translations.
本文标签:
版权声明:本文标题:Reason to add a name of the theme like ('menu-1' => __( 'Primary', 'twentyninetee 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745570925a2664043.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论