<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="Magenticians_Mymodule" setup_version="1.0.1"></module> </config>
<?php \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::MODULE, 'Magenticians_Mymodule', __DIR__ );
<?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="Magenticians\Mymodule\Block\Link" name="custom-header-link"> <arguments> <argument name="label" xsi:type="string" translate="true">Contact Us</argument> <argument name="path" xsi:type="string" translate="true">contact</argument> </arguments> </block> </referenceBlock> </body> </page>In the code above, I have added the contact us page link. You can change it according to your need.
<?php namespace Magenticians\Mymodule\Block; class Link extends \Magento\Framework\View\Element\Html\Link { /** * 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>'; } }
php bin/magento setup:upgrade php bin/magento setup:di:compile php bin/magento cache:clean php bin/magento cache:flushOpen your store and you will see the new link Contact Us:
Your greatest possible competitive advantage can be your clients and the interactions they have with… Read More
Digital marketing KPIs are measurable values that marketing teams use to track progress toward desired… Read More
In today's digital age, fraud poses a significant threat to businesses of all sizes. As… Read More
Financial crimes continue to evolve and proliferate in our increasingly digital, global economy. From complex… Read More
In the highly competitive modern workplace, trust, and employee loyalty are crucial factors for long-term… Read More
In the ever-evolving world of small business developing and implementing effective marketing strategies is critical to… Read More
View Comments
I have fallowed above said but it did not work for me. I did not get link on header link.
Did you have run all the CLI commands?