Magento – Magento 2 Insert Template into cms page

cmsmagento2template

I created a template (phtml) and placed it into my theme folder. I then went to a cms block and placed this

{{block class="Magento\Framework\View\Element\Template" template="Magento_Theme::footer-social.phtml"}}

Nothing renders. I've read other posts in regard to this and they all seem to be similar.

Best Answer

Looks like template path is incorrect.

In your example Magento will search your template at path:

app/code/Magento/Theme/view/frontend/templates/footer-social.phtml

Next syntax works for me, inserted directly into Content > Pages > Home Page > Content (WYSIWYG hidden)

{{block class="Magento\Framework\View\Element\Template" template="Yaronish_Cms::home.phtml"}}

enter image description here

File path app/code/Yaronish/Cms/view/frontend/templates/home.phtml

File Content

<div>My Home Template</div>
<?php
    echo microtime(true);
?>

Result: enter image description here