Is there any way to insert custom block in CMS page in Magento 2.2 alike inserting CMS block in CMS page?

  • You can call phtml file in cms page that contains specific block...Do u asking like this? – Ranganathan Oct 7 '17 at 11:49

If I get you right about custom block (template.phtml), you need to create custom template in (for example) app/code/<Package>/<Module>/view/frontend/templates/cms/customTemplate.phtml and then insert this template in a CMS Page via layout update (in admin panel):

<referenceContainer name="content">
    <block class="Magento\Framework\View\Element\Template" name="your.custom.name" template="<Package>_<Module>::cms/customTemplate.phtml" before="-" />

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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