Exclude categories in magento top navigation

We can achive this using below code

<?php $cats = Mage::getModel(‘catalog/category’)->load(2)->getChildrenCategories();
?>
<ul>
<?php foreach($cats as $category): ?>
<?php if (!in_array($category->getId(), array(6,7,8,9))) : ?>
<li>
<a href=”getUrl() ?>”><span>getName() ?></span></a>
</li>
<?php endif; ?>
<?php endforeach; ?>

</ul>

Note : 6,7,8,9 are the categories which you want to execlude, you should replace with yours

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

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