0

I was trying to add this solution link but it's only removing links but without adding new ones. My parent theme is Blank theme, so I use header.links (not top.links)

Edited file app/design/frontend/Myvendorname/Mytheme/Magento_Theme/layout/default.xml

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

<!-- here you can remove whatever link you feel unwanted -->
<referenceBlock name="register-link" remove="true" />           <!--for Create Account Link-->
<referenceBlock name="authorization-link" remove="true" />      <!--for Sign In Link  -->
<referenceBlock name="wish-list-link" remove="true" />          <!--for WishList Link-->
<referenceBlock name="my-account-link" remove="true" />         <!--for My Account Link-->
</referenceBlock>
0

Ok I found solution. I just change position of one plus I change panel.links to header.panel. Panel.links class is inside header.panel.

and code that I put inside app/design/frontend/Myvendorname/Mytheme/Magento_Theme/layout/default.xml

is now:

<?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.panel">
<block class="Magento\Framework\View\Element\Html\Link" name="new.link" after="register-link">
    <arguments>
        <argument name="label" xsi:type="string" translate="false">Contact</argument>
        <argument name="path" xsi:type="string" translate="false">contact</argument>

    </arguments>
</block>
<block class="Magento\Framework\View\Element\Html\Link" name="new.link2" after="new-link">
    <arguments>
        <argument name="label" xsi:type="string" translate="false">About Us</argument>
        <argument name="path" xsi:type="string" translate="false">about-us</argument>

    </arguments>
</block>
<block class="Magento\Framework\View\Element\Html\Link" name="new.link3" after="new-link2">
    <arguments>
        <argument name="label" xsi:type="string" translate="false">Customer Support</argument>
        <argument name="path" xsi:type="string" translate="false">customer-support</argument>

    </arguments>
</block>

    </referenceBlock>

    <!-- here you can remove whatever link you feel unwanted -->
    <referenceBlock name="register-link" remove="true" />           <!--for Create Account Link-->
    <referenceBlock name="authorization-link" remove="true" />      <!--for Sign In Link  -->
    <referenceBlock name="wish-list-link" remove="true" />          <!--for WishList Link-->
    <referenceBlock name="my-account-link" remove="true" />         <!--for My Account Link-->


    </body>
    </page>

Helpful link from Magento2 documentation here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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