How to show cms static block from template phtml file in Magento 2

Are you wondering how to show CMS Static Block from template `phtml` file in Magento 2? Here you are, the effective intrucstion in this topic.

Are you wondering how to show CMS Static Block from template phtml file in Magento 2? Here you are, the effective intrucstion in this topic.

Use the below code snippet if you want to show CMS Static Block in any template in Magento 2:

echo $this->getLayout()
          ->createBlock('Magento\Cms\Block\Block')
          ->setBlockId('your_block_identifier')
          ->toHtml();

For another block within CMS Block in Magento 2, please use the below code to show it.

{{block class="Magento\Cms\Block\Block" block_id="your_block_identifier"}}

Hope this is the helpful article to show cms static block from template phtml file in Magento 2. In case that you have any queries about the article or any questions in general, use the comment section below!

Enjoyed the tutorial? Spread it to your friends!

magento-2-tutorial
show
cms
static
block
template
phtml
file

Sam Thomas
Sam Thomas

CEO and Founder of Mageplaza. Pursueing a simple and healthy lifestyle. A friend, a husband and a dad of two children, a trainer and a wanna-be influencer. He is a big fan of sports and travel, also.

People also searched for

  • magento 2 show cms static block from template phtml file
  • show cms static block from template phtml file in magento 2
  • how to show cms static block from template phtml file
  • how to show cms static block from template phtml file in magento 2
  • 2.2.x, 2.3.x