1

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?

1
  • 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

1

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

to

app/design/frontend/Magento/MyTheme/Magento_Theme/templates/extra/test_view.phtml

15

Your Answer

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

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