1

I have a Magento 2.3 website that has a child theme of Luma setup and bootstrap added. What I want is to in the footer is to call in a customfooter.phtml file so I can setup the footer to be a 4col layout. then under the footer and full page width I am trying to add a new div that would call in a footer-links.phtml file and load right before the closing body tag and outside the page wrapper.

My issue is the default.xml does not see to work even though I recompiled and deployed and cleared cache.

Here is my default.xml file

    <?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="header.panel">
        <block class="Magento\Framework\View\Element\Html\Links" name="header.links">
            <arguments>
                <argument name="css_class" xsi:type="string">header links</argument>
            </arguments>
        </block>
    </referenceContainer>
    <referenceBlock name="logo">
        <arguments>
            <argument name="logo_img_width" xsi:type="number">148</argument>
            <argument name="logo_img_height" xsi:type="number">43</argument>
        </arguments>
    </referenceBlock>

    <block class="Magento\Framework\View\Element\Template" name="customfooter" template="Magento_Theme::html/custom/customfooter.phtml" />

    <!--this is use for remove default elements -->
    <referenceBlock name="copyright" remove="true"/>
    <referenceBlock name="report.bugs" remove="true"/>

    <referenceBlock name="switcher-store" remove="true"/>
    <referenceBlock name="catalog.compare.sidebar" remove="true"/>
    <referenceBlock name="form.subscribe" remove="true"/>
    <!-- Footer Elements Ends -->
</body>

0

Add your template like this :

<referenceContainer name="footer-container">
    <container name="footer" as="footer" label="Page Footer" htmlTag="div" htmlClass="footer content">
       <block class="Magento\Framework\View\Element\Template" name="customfooter" template="Magento_Theme::html/custom/customfooter.phtml" />
    </container>
</referenceContainer>

OR

You can try this, create a cms block with name custom_footer and call this in your theme layout YOUR_THEME/layout/default.xml

<block class="Magento\Cms\Block\Block" name="footer-custom-block" after="-">
  <arguments>
      <argument name="block_id" xsi:type="string">custom_footer</argument>
  </arguments>
</block>
4
  • I really need it to be a phtml file that is called in because the phtml file calls in 3 static blocks in a 4 column layout.
    – Jayreis
    Feb 23 '20 at 10:49
  • Updated follow steps to create new block. Feb 23 '20 at 10:54
  • See my OP I updated my default.xml and compiled deployed and cleared cache but I don't see my phtml file being loaded?
    – Jayreis
    Feb 23 '20 at 11:14
  • You need to add in referenceContainer element. Check updated post. Feb 23 '20 at 11:44
0

In default.xml file use below code to call custom phtml file in footer

<referenceContainer name="footer-container">
    <block class="Magento\Framework\View\Element\Template" name="customfooter" template="Magento_Theme::html/custom/customfooter.phtml" />
</referenceContainer>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.