I'm trying to add custom template from my custom module.
Layout file: app/code/Foo/Bar/view/frontend/layout/default.xml
<?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">
<block class="Foo\Bar\Block\FooterTest" name="footer_assets" template="footer/test.phtml" />
</referenceContainer>
</body>
</page>
my template: app/code/Foo/Bar/view/frontend/templates/footer/test.phtml
<span>test</span>
When i rename layout file from default.xml to cms_index_index.xml then template is displayed, but only on home page. What i have to change to display this template on all pages?
Best Answer
In you default.xml you can add
after="footer_links"
and mention your module template like"Foo_Bar::footer/test.phtml"
I have tried below code and working fine for me.
Hope this answer will help.