I need to show 6 specific categories on my Magento home page. I have the category ids with me. I want to display both the category image and name of that specific category. I have created a category.phtml
and have the following code in this file.
<?php
$categoryHelper = $this->helper('Magento\Catalog\Helper\Category');
foreach($categoryHelper->getStoreCategories() as $category):
?>
<li>
<a href="<?php echo $categoryHelper->getCategoryUrl($category) ?>">
<?php echo $category->getName() ?>
</a>
</li>
<?php endforeach; ?>
And called this phtml in cms home page as:
{{block class="Magento\Framework\View\Element\Template" template="Vendor_Theme::category.phtml"}}
But it is showing only the root categories. Please help.