2

I tried to override the app/design/frontend/Vendor/MyTheme/Magento_Theme/layout/default.xml, but it doesn't show any changes. I want to add custom links in top.links of parent theme (blank theme):

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
 <referenceBlock name="top.links">
 <block class="Magento\Framework\View\Element\Html\Link\Current" name="contact-us">
 <arguments>
 <argument name="label" xsi:type="string">Contact Us</argument>
 <argument name="path" xsi:type="string">contact-us</argument>
 </arguments>
 </block>
 </referenceBlock>
</body>

Like here: http://www.webmull.com/how-to-add-custom-top-links-in-magento-2-header/

I've flushed the cache, but it doesn't show any custom link.

Thank for your help.

asked Mar 10, 2016 at 11:03

1 Answer 1

3

there is one minor mistakes in your code

 <block class="Magento\Framework\View\Element\Html\Link\Current" name="contact-us">

Replace your block name "Contact-us" to "contactus.link"

below is the correct code please review

for extended Blank Theme

app/design/frontend/Amydus/test/Magento_Theme/layout/default.xml

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
 <body>
 <!-- you can easly add New links with following code -->
 <referenceBlock name="top.links">
 <!-- Contact us Link -->
 <block class="Magento\Framework\View\Element\Html\Link" name="contactus.link" after="register-link">
 <arguments>
 <argument name="label" xsi:type="string" translate="false">Constact Us</argument>
 <argument name="path" xsi:type="string" translate="false">contact-us</argument>
 </arguments>
 </block>
 </referenceBlock>
 </body>
</page>
answered Mar 25, 2016 at 5:34

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.