Reason to add a name of the theme like ('menu-1' => __( 'Primary', 'twentynineteen' ),) in PHP?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
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!
php theme-development themes
New contributor
add a comment |
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!
php theme-development themes
New contributor
add a comment |
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!
php theme-development themes
New contributor
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!
php theme-development themes
php theme-development themes
New contributor
New contributor
New contributor
asked Apr 20 at 8:06
JoeyJoey
134
134
New contributor
New contributor
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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.
Haha, you were faster. I was about to push the submit button :p
– Krzysiek Dróżdż♦
Apr 20 at 8:18
1
Haha, I had the feeling that answering to this question would be a speed typing contest :D
– Antti Koskinen
Apr 20 at 8:23
Thank you both for getting back to me with a pointer. I'll read the resource. Thanks!
– Joey
Apr 20 at 8:26
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "110"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Joey is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fwordpress.stackexchange.com%2fquestions%2f334851%2freason-to-add-a-name-of-the-theme-like-menu-1-primary-twentyninete%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
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.
Haha, you were faster. I was about to push the submit button :p
– Krzysiek Dróżdż♦
Apr 20 at 8:18
1
Haha, I had the feeling that answering to this question would be a speed typing contest :D
– Antti Koskinen
Apr 20 at 8:23
Thank you both for getting back to me with a pointer. I'll read the resource. Thanks!
– Joey
Apr 20 at 8:26
add a comment |
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.
Haha, you were faster. I was about to push the submit button :p
– Krzysiek Dróżdż♦
Apr 20 at 8:18
1
Haha, I had the feeling that answering to this question would be a speed typing contest :D
– Antti Koskinen
Apr 20 at 8:23
Thank you both for getting back to me with a pointer. I'll read the resource. Thanks!
– Joey
Apr 20 at 8:26
add a comment |
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.
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.
edited Apr 20 at 8:42
answered Apr 20 at 8:17
Antti KoskinenAntti Koskinen
9471412
9471412
Haha, you were faster. I was about to push the submit button :p
– Krzysiek Dróżdż♦
Apr 20 at 8:18
1
Haha, I had the feeling that answering to this question would be a speed typing contest :D
– Antti Koskinen
Apr 20 at 8:23
Thank you both for getting back to me with a pointer. I'll read the resource. Thanks!
– Joey
Apr 20 at 8:26
add a comment |
Haha, you were faster. I was about to push the submit button :p
– Krzysiek Dróżdż♦
Apr 20 at 8:18
1
Haha, I had the feeling that answering to this question would be a speed typing contest :D
– Antti Koskinen
Apr 20 at 8:23
Thank you both for getting back to me with a pointer. I'll read the resource. Thanks!
– Joey
Apr 20 at 8:26
Haha, you were faster. I was about to push the submit button :p
– Krzysiek Dróżdż♦
Apr 20 at 8:18
Haha, you were faster. I was about to push the submit button :p
– Krzysiek Dróżdż♦
Apr 20 at 8:18
1
1
Haha, I had the feeling that answering to this question would be a speed typing contest :D
– Antti Koskinen
Apr 20 at 8:23
Haha, I had the feeling that answering to this question would be a speed typing contest :D
– Antti Koskinen
Apr 20 at 8:23
Thank you both for getting back to me with a pointer. I'll read the resource. Thanks!
– Joey
Apr 20 at 8:26
Thank you both for getting back to me with a pointer. I'll read the resource. Thanks!
– Joey
Apr 20 at 8:26
add a comment |
Joey is a new contributor. Be nice, and check out our Code of Conduct.
Joey is a new contributor. Be nice, and check out our Code of Conduct.
Joey is a new contributor. Be nice, and check out our Code of Conduct.
Joey is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to WordPress Development Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fwordpress.stackexchange.com%2fquestions%2f334851%2freason-to-add-a-name-of-the-theme-like-menu-1-primary-twentyninete%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown