I want to remove the default links of the luma layout and add new links. How can I do that?
4 Answers
"About us" link and "Customer Service" link: Static block with Identifier is "footer_links_block"
To remove other links, use xml file (default.xml) and add this code into < body > tag:
<referenceBlock name="name_of_link_block" remove="true"/>
Name of link block:
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
To add new links to footer links, use this code:
<referenceBlock name="footer_links">
<block class="Magento\Framework\View\Element\Html\Link\Current" name="your-link-name">
<arguments>
<argument name="label" xsi:type="string">Title</argument>
<argument name="path" xsi:type="string">path-of-your-page</argument>
</arguments>
</block>
</referenceBlock>
-
6@Magev2 What method did you use to retrieve the block names? Dec 16, 2015 at 16:13
-
2Same as Magento 1, the name of footer link blocks will be added in the related modules, you can find at default.xml (frontend layout) of the module. eg: contact-us-link (vendor\magento\module-contact\view\frontend\layout\default.xml), or you can search into vendor\magento with keyword is "<referenceBlock name="footer_links">" Dec 17, 2015 at 3:22
-
@Magev2 How can we do this by having the default.xml inside app/design/frontend folder? I am not interested to touch anything inside vendor folder. Jan 12, 2016 at 23:02
-
You can add this code: <referenceBlock name="name_of_link_block" remove="true"/> to any default.xml file from your theme (app/design/frontend/Your_Vendor/Your_Theme/Magento_Modulename/layout/default.xml) Jan 13, 2016 at 3:35
-
If you want to remove all the links in footer that come by default, remove the reference block.
Simply add the following link in <Vendor>\<theme>\Magento_Theme\layout\default.xml
under <body>
container
<referenceBlock name="footer_links" remove="true"/>
and in same layout file add static block so you can manage footer menu from CMS static block from magento backend
<referenceContainer name="footer">
<block class="Magento\Cms\Block\Block" name="footer_menu">
<arguments>
<argument name="block_id" xsi:type="string">footer_menu</argument>
</arguments>
</block>
</referenceContainer>
Now you can create a static block with identifier as footer_menu
You need to add
<referenceBlock name="footer_links" remove="true" />
to default.xml file
See here for more info http://blog.i13websolution.com/how-to-remove-footer-links-magento-2/
footers links are added from two place
1. in cms block footer_links_block you can edit which will reflect in footer
2. in all core module search referenceBlock="footer_links" in xml files where ever they added links all are display in footer