login to magento admin. Open any cms page and write block code in content section.

{{block class="Magento\Framework\View\Element\Template" name="test_file" template="Magento_Theme::test.phtml"}} After using the block code phtml file will be called on cms page but after Footer.

How can we call before footer

  • Can you let me know how you added the block to the cms page? Usually, it will be before the footer. You know you can edit the content in the admin. I mean, it's ordered like this Header, Content, and Footer.
    – Aaron Wang
    Commented Sep 16, 2022 at 17:33
  • I added phtml file then i created new cms page and added below code {{block class="Magento\Framework\View\Element\Template" name="test_file" template="Magento_Theme::test.phtml"}} prnt.sc/RRuD32GqgXJP
    – kiran
    Commented Sep 16, 2022 at 18:30
  • Ok, And it is added after the footer block?
    – Aaron Wang
    Commented Sep 16, 2022 at 18:47
  • no prnt.sc/zrmq5zhQSr2A
    – kiran
    Commented Sep 16, 2022 at 19:05
  • You don't understand. Is it added after the footer block?
    – Aaron Wang
    Commented Sep 17, 2022 at 3:49

1 Answer 1


You can achieve this by adding the widget.

  1. Add widget

  2. Select Type (CMS Static Block)

  3. Select Theme (Your Theme)

  4. Widget Title

  5. Assign to Store View

  6. Click on Add Layout Update

  7. Display on All Pages

  8. Select Before Page footer from Container

  9. Change the section to Widget Options

  10. Select the Static Block

  11. Click on Save.

Clear the cache and navigate your browser to view.

enter image description here

Now you can view your block before the page footer.

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.