How to override footer template in a custom theme
The configuration of the footer can be seen in this file: vendor/magento/module-theme/view/frontend/layout/default.xml
I was able to modify the footer declaration by creating my 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 my custom footer.phtml
file is called instead of the containers/blocks defined in the original default.xml
.
I found out what was my problem.
Firstly I enabled the template path hints mode as described here: http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/themes/debug-theme.html
Thanks to path hints, I understood that the theme was not using the footer.phtml
file, but was using bugreport.phtml
and copyright.phtml
both from the magento-theme
module.
So I created these two templates:
app/design/frontend/<Vendor>/<ThemeName>/Magento_Theme/templates/html/bugreport.phtml
app/design/frontend/<Vendor>/<ThemeName>/Magento_Theme/templates/html/copyright.phtml
And now I'm able to override them from my custom theme.