Magento 2 add remove footer link
Today we talk about how in magento 2 add remove footer link. This tutorial will include how to add footer link, how to remove footer link and how to add custom link in footer. So first we listed all current link that are available in footer.
Footer Links
Here is all available footer link.
Title Name
Privacy and Cookie Policy privacy-policy-link
Search Terms search-term-popular-link
Contact Us contact-us-link
Advanced Search catalog-search-advanced-link
Orders and Returns sales-guest-form-link
Remove Footer link
Now we will remove a link from footer links. For example we want to remove Privacy and Cookie Policy link from footer. For that we will use his code privacy-policy-link. Just simple use remove block code. First create default.xml in view/frontend/layout
<!--/**
* Simple Hello World Module
*
* @category QaisarSatti
* @package QaisarSatti_HelloWorld
* @author Muhammad Qaisar Satti
* @Email qaisarssatti@gmail.com
*
*/ -->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="privacy-policy-link" remove="true"/>
</body>
</page>
Same example go for other links too.
Add Footer link
Now we will add the custom link in footer links. For example you want to add footer link title Hello World and there must be unique name helloworld.First create default.xml in view/frontend/layout
<!--/**
* Simple Hello World Module
*
* @category QaisarSatti
* @package QaisarSatti_HelloWorld
* @author Muhammad Qaisar Satti
* @Email qaisarssatti@gmail.com
*
*/ -->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="footer_links">
<block class="Magento\Framework\View\Element\Html\Link\Current" name="helloworld">
<arguments>
<argument name="label" xsi:type="string">Hello World</argument>
<argument name="path" xsi:type="string">helloworld</argument>
</arguments>
</block>
</referenceBlock>
</body>
</page>