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 an influencer wannabe. He is a big fan of sports and travel, also.

People also searched for

  • call static block in phtml magento 2
  • magento 2 cms block in phtml
  • magento 2 add cms block to phtml
  • magento 2 call static block in phtml
  • magento 2 call cms block in phtml
  • magento 2 get cms block in phtml
  • how to call static block in phtml file in magento 2
  • get cms block in phtml magento 2
  • get static block in phtml magento 2
  • add cms block in phtml magento 2
  • call cms block in phtml magento 2
  • magento 2 static block in phtml
  • magento 2 get static block in phtml
  • magento 2 add static block to phtml
  • magento 2 get block in phtml
  • magento 2 load cms block by identifier
  • get block in phtml magento 2
  • call cms block in phtml file magento 2
  • magento 2 render block in phtml
  • call block in phtml magento 2
  • 2.2.x, 2.3.x, 2.4.x