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.

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

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

Please leave comments if you have any questions, feedbacks.

Module Development

You also may like these Magento 2 Extensions

One Step Checkout

$199
10 reviews

Layered Navigation

$99
12 reviews

SEO

FREE
no review

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