How to call a static block on CMS

If you want to call a static block on CMS, Just follow these steps:

  1. Login to admin page->content->pages, we will choose and edit your CMS “homepage”.
  2. Go to tab design and insert the command and save CMS page:
  3. “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”.

Step 1:

Login to admin page->content->pages we will choose and edit the CMS “homepage”.

Step 2:

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:

  1. Login to admin page->content->pages, Widgets and pop “Add New widget”
  2. You can choose a type as “CMS Static Block” and select “Magento luma”(design packets/theme) and click continue.
  3. now you can select “Widget Title”, “store” and “Sort Order “ in “Storefront Properties “tab.
  4. And then you can choose a static piece contact us info from in the “Widget Option” tab.
  5. On the “Storefront Properties” tab, tap on the “Widget Layout Update” button and choose a option from show o dropdown “Particular page”.
  6. Now you can select “CMS homepage” in the page option and choose “Main Content Top “in the holder option.


Posted

in

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *