Here are the steps that you will follow in this How To Call a Static Block On CMC Page:
- Login to admin page -> content -> pages, we will select and edit the cms “Home Page”.
- Go to the tab design and insert the command and save page
- Go to the homepage, you will see the contact us info
While working on a project, You might have to add a unique static block between the header and main content of the CMS page on each CMS page. Via Magento admin panel, Element can be fully customizable and it can be easy to create on new CMS pages, easily modifiable , removable. Because element need to be placed outside of the main content, element can not be added using CMS in Magento admin. It can be added using Magento layouts.
On the Magento admin panel, by editing CMS page from CMS editor, Magento enables us to define a custom layout for every CMS page. In addition, layout for a CMS page is modified using defined values for that specific page which are stored in the database.Here’s how you might achieve that.
We will try to add the block “contact-us-info” into the cms “Home Page”.
Login to admin page -> content -> pages, we will select and edit the cms “Home Page”.
Go to the tab design and insert the command and save page:
<block class="Magento\Cms\Block\Block" name="test">
<argument name="block_id" xsi:type="string">contact-us-info</argument>
- Now, go to the homepage, you will see the contact us info.
By another way:
|1||Login to admin page -> content -> Widgets and click “Add New Widget”.|
|2||You can select type as “CMS Static Block” and select “Magento luma” ( Design Package/Theme ) and click continue|
|3||Now, you can set “Widget Title”, “Store” and “Sort order” in “Storefront properties” tab.|
|4||And then you can select static block contact-us-info from in the “Widget options” tab.|
|5||On the “Storefront properties” tab, click on “Add Layout Update” button and select option from display on dropdown “Specific page”.|
|6||Now, you can choose “CMS home page” in the page option and choose “main content top” in the container option.|
Ready to foster your knowledge