If you want to call a static block on CMS, Just follow these steps:
- Login to admin page->content->pages, we will choose and edit your CMS “homepage”.
- Go to tab design and insert the command and save CMS page:
- “Go to homepage”, you will see contact us info.
While working on project, you may need to include a one of a kind static piece between header and main content of the CMS page on every CMS page. Through Magento admin panel, element can be fully modified and it can be easy to create on new CMS pages, simply modifiable, removable. Since component should be set outside of the main content, components cannot be included utilizing CMS in Magento admin. It can be included utilizing using Magento designs.Refer our previous post How to utilize Magento 2 CMS(content Management system)
On the magento admin panel, by alternating CMS page from CMS editor. Magento allow us to define a customer layout for every CMS page. Moreover CMS page is modified using defined value for particular page which are stock in database. Here’s how you may accomplish that.
We will aim to include the block “contact us info” into the CMS “home page”.
Login to admin page->content->pages we will choose and edit the CMS “homepage”.
Go to tab design and insert the command and save CMS page.
<referenceContainer name="content"> <block class="Magento\Cms\Block\Block" name="test"> <arguments> <argument name="block_id" xsi:type="string">contact-us-info</argument> </arguments> </block> </referenceContainer >
Presently,”go to home page”, you will see contact us info.
By another way to call a static block on CMS page:
- Login to admin page->content->pages, Widgets and pop “Add New widget”
- You can choose a type as “CMS Static Block” and select “Magento luma”(design packets/theme) and click continue.
- now you can select “Widget Title”, “store” and “Sort Order “ in “Storefront Properties “tab.
- And then you can choose a static piece contact us info from in the “Widget Option” tab.
- On the “Storefront Properties” tab, tap on the “Widget Layout Update” button and choose a option from show o dropdown “Particular page”.
- Now you can select “CMS homepage” in the page option and choose “Main Content Top “in the holder option.
Last Update: May 8, 2018