Magento 2 – How to Override Footer phtml

footermagento2

I want to customize my website footer. To do this I need to update footer, I don't want to customize vendor phtml as this is not recommended.

Current template is

vendor\magento\module-theme\view\frontend\templates\html\footer.phtml

Best Answer

Create your own default.xml file at app/design/frontend/<Vendor>/<ThemeName>/Magento_Theme/layout/default.xml with this content:

<?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>
        <referenceContainer name="footer-container">
            <block class="Magento\Theme\Block\Html\Footer" name="footer" template="html/footer.phtml"/>
        </referenceContainer>
    </body>
</page>

Now your custom footer.phtml file is called.

Note : Template path should be app/design/frontend/<Vendor>/<ThemeName>/Magento_Theme/templates/html/footer.phtml

Related Topic