I have tried many ways to call the custom phtml file in Static Block but none of them seems to work.

My file is located - app/design/frontend/Magento/MyTheme/Magento_Theme/extra/test_view.phtml

How i call the file in CMS Static Block -

{{block class="Magento\Framework\View\Element\Template" name="test_view" template="Magento_Theme::extra/test_view.phtml"}}

And when i add the static block to main content area, it just displays the code thats above. Am i doing something wrong?

  • it is because you are adding code in wysiwyg editor enable. When you add code disable editor first
    – Pawan
    Feb 11, 2019 at 3:20

1 Answer 1


Your file should replace from app/design/frontend/Magento/MyTheme/Magento_Theme/extra/test_view.phtml




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.