0

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

How should I do?

0

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.

3
  • 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 Jul 20 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. – Dhiren Vasoya Jul 21 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 Jul 21 at 17:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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