Reason to add a name of the theme like ('menu-1' => __( 'Primary', 'twentyninetee

Sorry for this novice question. I'd like to know why WordPress themes add their theme names many occasions in PHP f

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 badges
Add a comment  | 

1 Answer 1

Reset to default 2

The 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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745570925a4633677.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信