I'd like to display a static block in my CMS Homepage which lists all 1 level categories.

How should I do?

1 Answer 1


For Home Page :

  1. Go To Magento Admin -> Content -> Pages
  2. Edit your current Hompage which you set for the website.
  3. Now call your particular CMS Block using this code :

{{block class="Magento\Cms\Block\Block" block_id="block_identifier"}}

For Category :

  1. Go To Magento Admin -> Catalog -> Categories.
  2. Edit the Category into which you want to show that block.
  3. Go To Display Setting section on right side.
  4. Set "Display Mode" either to "Static block only" or "Static block and products" according to your requirement.
  5. Set your CSM block into the "Add CMS Block" fields.

Now clear the cache and check the frontend.

  • Thanks for your reply but what I'd like to achieve is to list and display, with some PHP code, all the first level categories in the static block.
    – KaMZaTa
    Commented Jul 20, 2021 at 11:45
  • Then you can added the block by xml for all categories, and in phtml first check if this is first level category then show the block otherwise not. Commented Jul 21, 2021 at 10:39
  • I want to add the block to the homepage only, then, in that block, I'd like to list all first level categories using PHP.
    – KaMZaTa
    Commented Jul 21, 2021 at 17:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.