How can add link in Header link Before the Welcome Message in magento 2
How can add a custom page link in the header Before the Welcome Message
magento2 headerlink
add a comment |
How can add a custom page link in the header Before the Welcome Message
magento2 headerlink
2
I donot think this is a duplicated answer
– Amit Bera♦
Mar 18 at 6:53
add a comment |
How can add a custom page link in the header Before the Welcome Message
magento2 headerlink
How can add a custom page link in the header Before the Welcome Message
magento2 headerlink
magento2 headerlink
edited Mar 18 at 6:52
Amit Bera♦
59.5k1676177
59.5k1676177
asked Mar 18 at 6:42
HaFiz UmerHaFiz Umer
3949
3949
2
I donot think this is a duplicated answer
– Amit Bera♦
Mar 18 at 6:53
add a comment |
2
I donot think this is a duplicated answer
– Amit Bera♦
Mar 18 at 6:53
2
2
I donot think this is a duplicated answer
– Amit Bera♦
Mar 18 at 6:53
I donot think this is a duplicated answer
– Amit Bera♦
Mar 18 at 6:53
add a comment |
4 Answers
4
active
oldest
votes
Please check on below URL. it shows how to add custom blog link.
Let me know if it helps.
https://zemez.io/magento/support/how-to/magento-2-1-x-manage-top-header-links/
Also, need to update theme default.xml file with below code.
<referenceBlock name="header.panel">
<block class="MagentoCmsBlockBlock" name="header_promo_top">
<arguments>
<argument name="block_id" xsi:type="string">header_promo_top</argument>
</arguments>
</block>
</referenceBlock>
2
Please donot p put a single link answer.Answer must has some content
– Amit Bera♦
Mar 18 at 6:55
@AmitBera, Thank you. i will take care from next time.
– Yogesh
Mar 18 at 7:09
add a comment |
Step 1: create a CMS page. For example, we create a “Custom Link” page with an URL such as http://localhost/custom_link
Step 2: Create a default.xml file in the following path: appcodeVendorModuleviewfrontendlayout
with the following content:
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="header.links">
<block class=”Vendor_nameModule_nameBlockLink" name="some_link" >
<arguments>
<argument name="label" xsi:type="string" translate="true">Custom link</argument>
<argument name="path" xsi:type="string">test</argument>
</arguments>
</block>
</referenceBlock>
</body>
Step 3: Create the Block class Link with the following content:
<?php
namespace VendorModuleBlock;
class Link extends MagentoFrameworkViewElementHtmlLink
{
/**
* Render block HTML.
*
* @return string
*/
protected function _toHtml()
{
if (false != $this->getTemplate()) {
return parent::_toHtml();
}
return '<li><a ' . $this->getLinkAttributes() . ' >' . $this->escapeHtml($this->getLabel()) . '</a></li>';
}
}
I hope it helps!
add a comment |
Add this code in default.xml
<referenceBlock name="header.links">
<block class="MagentoCustomerBlockAccountRegisterLink" name="register-link-new" after="-">
<arguments>
<argument name="label" xsi:type="string" translate="true">Create an Account</argument>
</arguments>
</block>
<block class="VendorModuleBlockToplink" name="add.subscriptionplan.top" ifconfig="Vendor_Module/general/enable" after="-" />
</referenceBlock>
<referenceBlock name="register-link" remove="true"/>
add a comment |
@Chirag Patel code almost right.
Only have to add below code after
<move element="some_link" destination="header.links" before="-"/>
or
<move element="some_link" destination="header.links" before="header"/>
after </referenceBlock>
tab on default.xml.
It will move your link at first
Thanks @Amit Bera for make good answer to perfect answer. +1 for this. :)
– Chirag Patel
Mar 18 at 7:22
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "479"
};
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
});
}
});
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%2fmagento.stackexchange.com%2fquestions%2f266268%2fhow-can-add-link-in-header-link-before-the-welcome-message-in-magento-2%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
Please check on below URL. it shows how to add custom blog link.
Let me know if it helps.
https://zemez.io/magento/support/how-to/magento-2-1-x-manage-top-header-links/
Also, need to update theme default.xml file with below code.
<referenceBlock name="header.panel">
<block class="MagentoCmsBlockBlock" name="header_promo_top">
<arguments>
<argument name="block_id" xsi:type="string">header_promo_top</argument>
</arguments>
</block>
</referenceBlock>
2
Please donot p put a single link answer.Answer must has some content
– Amit Bera♦
Mar 18 at 6:55
@AmitBera, Thank you. i will take care from next time.
– Yogesh
Mar 18 at 7:09
add a comment |
Please check on below URL. it shows how to add custom blog link.
Let me know if it helps.
https://zemez.io/magento/support/how-to/magento-2-1-x-manage-top-header-links/
Also, need to update theme default.xml file with below code.
<referenceBlock name="header.panel">
<block class="MagentoCmsBlockBlock" name="header_promo_top">
<arguments>
<argument name="block_id" xsi:type="string">header_promo_top</argument>
</arguments>
</block>
</referenceBlock>
2
Please donot p put a single link answer.Answer must has some content
– Amit Bera♦
Mar 18 at 6:55
@AmitBera, Thank you. i will take care from next time.
– Yogesh
Mar 18 at 7:09
add a comment |
Please check on below URL. it shows how to add custom blog link.
Let me know if it helps.
https://zemez.io/magento/support/how-to/magento-2-1-x-manage-top-header-links/
Also, need to update theme default.xml file with below code.
<referenceBlock name="header.panel">
<block class="MagentoCmsBlockBlock" name="header_promo_top">
<arguments>
<argument name="block_id" xsi:type="string">header_promo_top</argument>
</arguments>
</block>
</referenceBlock>
Please check on below URL. it shows how to add custom blog link.
Let me know if it helps.
https://zemez.io/magento/support/how-to/magento-2-1-x-manage-top-header-links/
Also, need to update theme default.xml file with below code.
<referenceBlock name="header.panel">
<block class="MagentoCmsBlockBlock" name="header_promo_top">
<arguments>
<argument name="block_id" xsi:type="string">header_promo_top</argument>
</arguments>
</block>
</referenceBlock>
edited Mar 18 at 7:08
answered Mar 18 at 6:46
YogeshYogesh
332211
332211
2
Please donot p put a single link answer.Answer must has some content
– Amit Bera♦
Mar 18 at 6:55
@AmitBera, Thank you. i will take care from next time.
– Yogesh
Mar 18 at 7:09
add a comment |
2
Please donot p put a single link answer.Answer must has some content
– Amit Bera♦
Mar 18 at 6:55
@AmitBera, Thank you. i will take care from next time.
– Yogesh
Mar 18 at 7:09
2
2
Please donot p put a single link answer.Answer must has some content
– Amit Bera♦
Mar 18 at 6:55
Please donot p put a single link answer.Answer must has some content
– Amit Bera♦
Mar 18 at 6:55
@AmitBera, Thank you. i will take care from next time.
– Yogesh
Mar 18 at 7:09
@AmitBera, Thank you. i will take care from next time.
– Yogesh
Mar 18 at 7:09
add a comment |
Step 1: create a CMS page. For example, we create a “Custom Link” page with an URL such as http://localhost/custom_link
Step 2: Create a default.xml file in the following path: appcodeVendorModuleviewfrontendlayout
with the following content:
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="header.links">
<block class=”Vendor_nameModule_nameBlockLink" name="some_link" >
<arguments>
<argument name="label" xsi:type="string" translate="true">Custom link</argument>
<argument name="path" xsi:type="string">test</argument>
</arguments>
</block>
</referenceBlock>
</body>
Step 3: Create the Block class Link with the following content:
<?php
namespace VendorModuleBlock;
class Link extends MagentoFrameworkViewElementHtmlLink
{
/**
* Render block HTML.
*
* @return string
*/
protected function _toHtml()
{
if (false != $this->getTemplate()) {
return parent::_toHtml();
}
return '<li><a ' . $this->getLinkAttributes() . ' >' . $this->escapeHtml($this->getLabel()) . '</a></li>';
}
}
I hope it helps!
add a comment |
Step 1: create a CMS page. For example, we create a “Custom Link” page with an URL such as http://localhost/custom_link
Step 2: Create a default.xml file in the following path: appcodeVendorModuleviewfrontendlayout
with the following content:
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="header.links">
<block class=”Vendor_nameModule_nameBlockLink" name="some_link" >
<arguments>
<argument name="label" xsi:type="string" translate="true">Custom link</argument>
<argument name="path" xsi:type="string">test</argument>
</arguments>
</block>
</referenceBlock>
</body>
Step 3: Create the Block class Link with the following content:
<?php
namespace VendorModuleBlock;
class Link extends MagentoFrameworkViewElementHtmlLink
{
/**
* Render block HTML.
*
* @return string
*/
protected function _toHtml()
{
if (false != $this->getTemplate()) {
return parent::_toHtml();
}
return '<li><a ' . $this->getLinkAttributes() . ' >' . $this->escapeHtml($this->getLabel()) . '</a></li>';
}
}
I hope it helps!
add a comment |
Step 1: create a CMS page. For example, we create a “Custom Link” page with an URL such as http://localhost/custom_link
Step 2: Create a default.xml file in the following path: appcodeVendorModuleviewfrontendlayout
with the following content:
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="header.links">
<block class=”Vendor_nameModule_nameBlockLink" name="some_link" >
<arguments>
<argument name="label" xsi:type="string" translate="true">Custom link</argument>
<argument name="path" xsi:type="string">test</argument>
</arguments>
</block>
</referenceBlock>
</body>
Step 3: Create the Block class Link with the following content:
<?php
namespace VendorModuleBlock;
class Link extends MagentoFrameworkViewElementHtmlLink
{
/**
* Render block HTML.
*
* @return string
*/
protected function _toHtml()
{
if (false != $this->getTemplate()) {
return parent::_toHtml();
}
return '<li><a ' . $this->getLinkAttributes() . ' >' . $this->escapeHtml($this->getLabel()) . '</a></li>';
}
}
I hope it helps!
Step 1: create a CMS page. For example, we create a “Custom Link” page with an URL such as http://localhost/custom_link
Step 2: Create a default.xml file in the following path: appcodeVendorModuleviewfrontendlayout
with the following content:
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="header.links">
<block class=”Vendor_nameModule_nameBlockLink" name="some_link" >
<arguments>
<argument name="label" xsi:type="string" translate="true">Custom link</argument>
<argument name="path" xsi:type="string">test</argument>
</arguments>
</block>
</referenceBlock>
</body>
Step 3: Create the Block class Link with the following content:
<?php
namespace VendorModuleBlock;
class Link extends MagentoFrameworkViewElementHtmlLink
{
/**
* Render block HTML.
*
* @return string
*/
protected function _toHtml()
{
if (false != $this->getTemplate()) {
return parent::_toHtml();
}
return '<li><a ' . $this->getLinkAttributes() . ' >' . $this->escapeHtml($this->getLabel()) . '</a></li>';
}
}
I hope it helps!
answered Mar 18 at 6:59
Chirag PatelChirag Patel
2,368423
2,368423
add a comment |
add a comment |
Add this code in default.xml
<referenceBlock name="header.links">
<block class="MagentoCustomerBlockAccountRegisterLink" name="register-link-new" after="-">
<arguments>
<argument name="label" xsi:type="string" translate="true">Create an Account</argument>
</arguments>
</block>
<block class="VendorModuleBlockToplink" name="add.subscriptionplan.top" ifconfig="Vendor_Module/general/enable" after="-" />
</referenceBlock>
<referenceBlock name="register-link" remove="true"/>
add a comment |
Add this code in default.xml
<referenceBlock name="header.links">
<block class="MagentoCustomerBlockAccountRegisterLink" name="register-link-new" after="-">
<arguments>
<argument name="label" xsi:type="string" translate="true">Create an Account</argument>
</arguments>
</block>
<block class="VendorModuleBlockToplink" name="add.subscriptionplan.top" ifconfig="Vendor_Module/general/enable" after="-" />
</referenceBlock>
<referenceBlock name="register-link" remove="true"/>
add a comment |
Add this code in default.xml
<referenceBlock name="header.links">
<block class="MagentoCustomerBlockAccountRegisterLink" name="register-link-new" after="-">
<arguments>
<argument name="label" xsi:type="string" translate="true">Create an Account</argument>
</arguments>
</block>
<block class="VendorModuleBlockToplink" name="add.subscriptionplan.top" ifconfig="Vendor_Module/general/enable" after="-" />
</referenceBlock>
<referenceBlock name="register-link" remove="true"/>
Add this code in default.xml
<referenceBlock name="header.links">
<block class="MagentoCustomerBlockAccountRegisterLink" name="register-link-new" after="-">
<arguments>
<argument name="label" xsi:type="string" translate="true">Create an Account</argument>
</arguments>
</block>
<block class="VendorModuleBlockToplink" name="add.subscriptionplan.top" ifconfig="Vendor_Module/general/enable" after="-" />
</referenceBlock>
<referenceBlock name="register-link" remove="true"/>
answered Mar 18 at 6:52
Birjitsinh ZalaBirjitsinh Zala
564115
564115
add a comment |
add a comment |
@Chirag Patel code almost right.
Only have to add below code after
<move element="some_link" destination="header.links" before="-"/>
or
<move element="some_link" destination="header.links" before="header"/>
after </referenceBlock>
tab on default.xml.
It will move your link at first
Thanks @Amit Bera for make good answer to perfect answer. +1 for this. :)
– Chirag Patel
Mar 18 at 7:22
add a comment |
@Chirag Patel code almost right.
Only have to add below code after
<move element="some_link" destination="header.links" before="-"/>
or
<move element="some_link" destination="header.links" before="header"/>
after </referenceBlock>
tab on default.xml.
It will move your link at first
Thanks @Amit Bera for make good answer to perfect answer. +1 for this. :)
– Chirag Patel
Mar 18 at 7:22
add a comment |
@Chirag Patel code almost right.
Only have to add below code after
<move element="some_link" destination="header.links" before="-"/>
or
<move element="some_link" destination="header.links" before="header"/>
after </referenceBlock>
tab on default.xml.
It will move your link at first
@Chirag Patel code almost right.
Only have to add below code after
<move element="some_link" destination="header.links" before="-"/>
or
<move element="some_link" destination="header.links" before="header"/>
after </referenceBlock>
tab on default.xml.
It will move your link at first
answered Mar 18 at 7:16
Amit Bera♦Amit Bera
59.5k1676177
59.5k1676177
Thanks @Amit Bera for make good answer to perfect answer. +1 for this. :)
– Chirag Patel
Mar 18 at 7:22
add a comment |
Thanks @Amit Bera for make good answer to perfect answer. +1 for this. :)
– Chirag Patel
Mar 18 at 7:22
Thanks @Amit Bera for make good answer to perfect answer. +1 for this. :)
– Chirag Patel
Mar 18 at 7:22
Thanks @Amit Bera for make good answer to perfect answer. +1 for this. :)
– Chirag Patel
Mar 18 at 7:22
add a comment |
Thanks for contributing an answer to Magento 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%2fmagento.stackexchange.com%2fquestions%2f266268%2fhow-can-add-link-in-header-link-before-the-welcome-message-in-magento-2%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
2
I donot think this is a duplicated answer
– Amit Bera♦
Mar 18 at 6:53