{"id":7231,"date":"2019-09-20T11:31:08","date_gmt":"2019-09-20T06:01:08","guid":{"rendered":"https:\/\/www.hiddentechies.com\/blog\/?p=7231"},"modified":"2019-09-27T13:31:56","modified_gmt":"2019-09-27T08:01:56","slug":"magento-2-call-cms-static-block-phtml-file","status":"publish","type":"post","link":"https:\/\/www.hiddentechies.com\/blog\/magento-2\/magento-2-call-cms-static-block-phtml-file\/","title":{"rendered":"Magento 2 &#8211; How to Call CMS Static Block in phtml file"},"content":{"rendered":"<p>In this post I am going to explain how to to call CMS static block in phtml file.<\/p>\n<p>Use below code snippet to get CMS static block content in any template file.<\/p>\n<pre class=\"lang:default decode:true \">echo $this-&gt;getLayout()\r\n          -&gt;createBlock('Magento\\Cms\\Block\\Block')\r\n          -&gt;setBlockId('cms_static_block_identifier')\r\n          -&gt;toHtml();<\/pre>\n<p>Thats it. Enjoy Magento 2!!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this post I am going to explain how to to call CMS static block in phtml file. Use below code snippet to get CMS static block content in any template file. echo $this-&gt;getLayout() -&gt;createBlock(&#8216;Magento\\Cms\\Block\\Block&#8217;) -&gt;setBlockId(&#8216;cms_static_block_identifier&#8217;) -&gt;toHtml(); Thats it. Enjoy Magento 2!!<\/p>\n","protected":false},"author":1,"featured_media":7329,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[59],"tags":[10,27],"_links":{"self":[{"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/posts\/7231"}],"collection":[{"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/comments?post=7231"}],"version-history":[{"count":1,"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/posts\/7231\/revisions"}],"predecessor-version":[{"id":7232,"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/posts\/7231\/revisions\/7232"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/media\/7329"}],"wp:attachment":[{"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/media?parent=7231"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/categories?post=7231"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hiddentechies.com\/blog\/wp-json\/wp\/v2\/tags?post=7231"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}