2

My theme inherits from Blank. I know how to remove the footer links: Contact us, Advanced Search, etc... then I'd like to add a custom footer with 4 columns:

column 1 - Account links column 2 - general information links column 3 - Payment logo icons column 4 - Newsletter sign up form

All elements would be in a footer.phtml template, however I dont know how to add this phtml file to the footer area. And which folder this file should be located in? I know how to override templates, but the Blank theme does not have a footer.phtml enabled, so there is no a specific path to put my phtml file in.

2 Answers 2

1

In default.xml from module Magento\Theme add this code inside footer referenceContainer

<block class="Magento\Cms\Block\Block" name="block-footer" after="footer_links">
      <arguments>
            <argument name="block_id" xsi:type="string">block_footer_custom</argument>
      </arguments>
</block>

Goto backend Content > Blocks > Add new static block with identifier name block_footer_custom with any html code you need. It so easy to editable Clear cache and re-deploy static. Now you will get your custom block

====UPDATE====
Call block inside template

<?php echo $block->getLayout()->createBlock('Magento\Cms\Block\Block')->setBlockId('block_footer_custom')->toHtml();?>
4
  • Which folder should I put the phtml file into? Mar 27, 2016 at 22:42
  • You can add your own template. See in xml , inside block tag you can add attribute template to specific template of block
    – mrtuvn
    Mar 28, 2016 at 4:37
  • why did you choose class="Magento\Cms\Block\Block" here? Are there other options too? Or is there a place where i can see all possible classes? Kind of confused about that. thx
    – fogx
    Mar 29, 2018 at 8:53
  • Use cms block because this class you can pass identifier by arguments like you see in layout
    – mrtuvn
    Mar 30, 2018 at 1:18
2

The following solution works in Magento 2.1+ including Magento 2.2+. All instructions are based off you being logged into Magento as an admin.

  1. Create a CMS block with your links or anything you want to show in the footer:
    CONTENT > Blocks > Add New Block

  2. Add a new widget to your Magento installation:
    CONTENT > Widgets > Add Widget

  3. When the New Widget page first loads most options will be hidden you need to change the type to CMS Static Block and pick the theme to attach this widget to; you should choose the theme your using for your site.

  4. You may have to save the widget at this stage and then just re-open it for editing. Under Widget Options select the block you created in step 1.

  5. Click Save and Continue Edit and now you can finish setting up the new footer. Under the Layout Updates section you will need to tell it to Display on All Pages and then choose CMS Footer Links as the container option.

2
  • i fallowed but its not working for me. Dec 28, 2017 at 10:35
  • Worked for me V2.2.7 Jan 29, 2019 at 17:41

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.