Shopping cart

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

Brian Tran
Brian Tran
Senior Magento Developer who is passionate about development and love technology

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

We recommend:

You also may like these Magento 2 Extensions

One Step Checkout

$199
120 reviews

Layered Navigation

$99
61 reviews

Gift Card

$199
8 reviews

Reward Points

$99
8 reviews

Affiliate

$149
16 reviews

Shop By Brand

$99
19 reviews

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