Magento 2 add link and icon in header
-
14-04-2021 - |
Question
So I wanna add a Link with Icon and the text that says "Contact Us" beside "Mina sidor" in the header. So when u click on Contact Us u are directed to a different page with all contact information.
I have been adding this line of code to my Magento_Theme/layout/default.xml file and after that clearing the cache but nothing happens. I've been looking around but I doesn't seem to find where "Mina sidor" and "Varukorg" are made.
Am I looking in the wrong place?
<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>
</referenceBlock>
No correct solution
OTHER TIPS
Create a layout file
<?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 name="customblock" template="Vendor_Module::custom_file.phtml" after="-" />
</referenceBlock>
</body>
Now create a template file for this as mentioned in layout and write your code for Text, Link or Icon whatever you wish in the template file.
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange