I'm struggling including my custom module/block template into a static CMS page.

Here's my block code:

<block class="Magento\Framework\View\Element\Template" name="custom_slider_block" template="Custom_Slider::slider.phtml" />

How would I implement this in a static CMS page?


I've added a block file with the following code:

 namespace Custom\Slider\Block;

 class Slider extends \Magento\Framework\View\Element\Template
   public function _prepareLayout()
    return parent::_prepareLayout();

and changed my block call to:

{{block class="Custom\Slider\Block\Slider" template="Custom_Slider::slider.phtml"}}

But now I get the error:

Error filtering template: Invalid block type: Custom\Slider\Block\Slider

Edit 2:

Got it working, realised I hadn't included a registration.php file to actually enable the module.

  • What is your Block class ? Commented Sep 18, 2018 at 10:04
  • Do you mean this? namespace Custom\Slider\Block;
    – Howliee
    Commented Sep 18, 2018 at 10:29
  • what is path you have for slider.phtml in your module ? Commented Sep 18, 2018 at 10:30
  • Custom/Slider/view/frontend/templates/slider.phtml
    – Howliee
    Commented Sep 18, 2018 at 10:33
  • code looks right according to path {{block class="Custom\Slider\Block\Slider" template="Custom_Slider::slider.phtml"}} Commented Sep 18, 2018 at 10:38

1 Answer 1


Try the code below

{{block class="Magento\Framework\View\Element\Template" template="Custom_Slider::slider.phtml"}}
  • I tried your solution Richard and got this error: Error filtering template: Invalid template file: 'Custom_Slider::slider.phtml' in module: '' block's name: 'magento\framework\view\element\template_0'
    – Howliee
    Commented Sep 18, 2018 at 10:13
  • Just a couple of questions, 1) What is the name of your custom Module 2) Do you have a template called Slider.phtml file ? Commented Sep 18, 2018 at 10:53
  • The module is called Custom_Slider, Custom being the vendor. I do have a template called slider.phtml, lower case "s" which sits in Custom/Slider/view/frontend/templates/
    – Howliee
    Commented Sep 18, 2018 at 10:57

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.