1

I need to add some custom links on header just like below screenshot:-

enter image description here

But as i trying to add the same on "header.links" it's adding right side(near CONTACT US link).

how can i achieve my expected one?

3
  • Check the html where it rendering. It might be something related to css. Jun 17, 2019 at 10:56
  • 1
    By default Magento2 added right side but i needed the same left side. Jun 17, 2019 at 10:58
  • Are you working in default magento? Can you update the code which you are using to add this? Jun 17, 2019 at 10:58

1 Answer 1

1

In default.xml write below code.

<referenceBlock name="header.panel">
     <block class="Magento\Framework\View\Element\Html\Link" name="add-new-header-link" after="store_language"> 
         <arguments>
 <argument name="label" xsi:type="string" translate="true">New Link</argument>
 <argument name="path" xsi:type="string" translate="true">new-link</argument>
 </arguments>
     </block>
 </referenceBlock>

I hope it's usefully for you.

1
  • this works but <li> is generated without <ul> parent. any idea how we can add li inside ul with a custom class to further style in? Oct 30, 2020 at 13:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.