Question

I try to replace the footer with my own, but I have no clue how.

I activated template hints, but it does not show any hint if this is a static block.

enter image description here

How can I modify this ?

Was it helpful?

Solution

You can check this file in vendor directory.

vendor/magento/module-theme/view/frontend/layout/default.xml

In above file footer_links block created under footer-container section. In default Luma theme you can see below five links in footer section.

  • Search Terms
  • Privacy and Cookie Policy
  • Advanced Search
  • Orders and Returns
  • Contact Us

All above links are coming from different files.

Search Terms link coming from this file..

vendor/magento/module-search/view/frontend/layout/default.xml

Privacy and Cookie Policy link from..

vendor/magento/module-cms/view/frontend/layout/default.xml

and so on..

If you want to remove any link or you want to update link's action URL/Path then you need to create default.xml file in your custom module or custom theme.

For e.g. if you want to remove "Search Terms" link and you want to update label of "Orders and Returns" to "Returns" and you want to add new link then you can do this..

Create default.xml file here in your custom theme.

app/design/frontend/Vendor/Theme/Magento_Theme/layout/default.xml

Content for this file is..

<?xml version="1.0" encoding="UTF-8"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
   <body>
      <referenceBlock name="search-term-popular-link" remove="true" /> <!-- This will remove "Search Terms" link -->
      <referenceBlock name="footer_links"> <!-- This block will change label from "Orders and Returns" to "Returns" -->
            <block class="Magento\Sales\Block\Guest\Link" name="sales-guest-form-link">
                <arguments>
                    <argument name="label" xsi:type="string" translate="true">Returns</argument>
                    <argument name="path" xsi:type="string">sales/guest/form</argument>
                </arguments>
            </block>
            <!-- Below code is useful to add new "Custom link" in footer links -->
            <block class="Magento\Framework\View\Element\Html\Link\Current" name="new-custom-link">
                <arguments>
                    <argument name="label" xsi:type="string" translate="true">New Custom Link</argument>
                    <argument name="path" xsi:type="string">new/custom/url</argument>
                </arguments>
            </block>
        </referenceBlock>
   </body>
</page>

Output :

enter image description here

Hope this will help you!

OTHER TIPS

It's a block (name: footer_links) which just render set of children blocks, base declaration you can find in vendor/magento/module-theme/view/frontend/layout/default.xml:123

How to add new link:

        <referenceBlock name="footer_links">
            <block class="Magento\Framework\View\Element\Html\Link\Current" ifconfig="catalog/seo/search_terms" name="search-term-popular-link">
                <arguments>
                    <argument name="label" xsi:type="string" translate="true">Search Terms</argument>
                    <argument name="path" xsi:type="string">search/term/popular</argument>
                </arguments>
            </block>
        </referenceBlock>

How to remove link:

<referenceBlock name="search-term-popular-link" remove="true" />

which will remove first link on your screen.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top