1

I am creating custom footer to show the 5 Columns footer with 2 Rows. In first row to showing the CMS links and second row like copyrights and logs. for that I have written below code. But it is not showing. Even though I have executed php bin/magento cache:clean and php bin/magento cache:flush.

CustomFooter/view/frontend/layout/default.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="store.settings.language" remove="true"/>

        <referenceBlock name="logo">
            <arguments>
                <argument name="logo_file" xsi:type="string">images/logo.png</argument>
                <argument name="logo_img_width" xsi:type="number">100</argument>
                <argument name="logo_img_height" xsi:type="number">40</argument>
            </arguments>
        </referenceBlock>

        <referenceContainer name="footer-container">
            <container name="footer-top" label="Footer Top" htmlTag="div" htmlClass="footer-top page-main">
                <block class="Magento\Cms\Block\Block" name="block-footertop">
                    <arguments>
                        <argument name="block_id" xsi:type="string">block-footertop</argument>
                    </arguments>
                </block>
            </container>

            <container name="footer" as="footer" label="Page Footer" htmlTag="div" htmlClass="footer container">
                <remove name="form.subscribe"/>
                <block class="Magento\Theme\Block\Html\Footer" name="copyright" template="html/copyright.phtml"/>
                <block class="Magento\Framework\View\Element\Template" name="report.bugs" template="Magento_Theme::html/bugreport.phtml" />
            </container>

        </referenceContainer>

        <referenceBlock name="report.bugs" remove="true"/>
        <move element="copyright" destination="before.body.end"/>
    </body>
</page>

But it is not showing. Any help on this?

1 Answer 1

3

Use below code:

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="store.settings.language" remove="true"/>

        <referenceBlock name="logo">
            <arguments>
                <argument name="logo_file" xsi:type="string">images/logo.png</argument>
                <argument name="logo_img_width" xsi:type="number">100</argument>
                <argument name="logo_img_height" xsi:type="number">40</argument>
            </arguments>
        </referenceBlock>

         <referenceContainer name="footer-container">
           <container name="footer-top" label="Footer Top" htmlTag="div" htmlClass="footer-top page-main">
                <block class="Magento\Cms\Block\Block" name="block-footertop">
                    <arguments>
                        <argument name="block_id" xsi:type="string">block-footertop</argument>
                    </arguments>
                </block>
            </container>
        </referenceContainer>


        <referenceBlock name="form.subscribe" remove="true"/>


        <referenceBlock name="report.bugs" remove="true"/>
        <move element="copyright" destination="before.body.end"/>
    </body>
</page>
6
  • If I want to remove default links how? In my case only show my custom footer.
    – Bojjaiah
    Commented Nov 30, 2016 at 9:10
  • 1
    use this code <referenceBlock name="footer_links" remove="true"/> Commented Nov 30, 2016 at 9:12
  • news letter not removing. I have tried <referenceBlock name="footer.newsletter" remove="true"/> Is it correct?
    – Bojjaiah
    Commented Nov 30, 2016 at 9:28
  • 1
    Use this code <referenceBlock name="form.subscribe" remove="true"/> Commented Nov 30, 2016 at 9:38
  • If I want to show newsletter subscriber in my custom .phtml file <?php /** @var \Magento\Theme\Block\Html\Footer $block */ ?> <?php echo $block->getChildHtml('form.subscribe'); ?> Is it correct way to get the data? I am write this but not getting.
    – Bojjaiah
    Commented Nov 30, 2016 at 11:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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