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?

  • it is because you are adding code in wysiwyg editor enable. When you add code disable editor first – Pawan Feb 11 at 3:20
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

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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