5 min read

Add Home link in Magento top navigation menu

Add Home link in Magento top navigation menu

Last modified

By default there is no Home link in Magento top navigation menu but you can easily add it yourself.

1- Copy following 2 files

design/frontend/base/template/page/html/topmenu.phtml
design/frontend/base/template/catalog/navigation/top.phtml

TO

design/frontend/default/yourtheme/template/page/html/topmenu.phtml
design/frontend/default/yourtheme/template/catalog/navigation/top.phtml

2. Replace the content with following code


<?php $_menu = $this->getHtml('level-top') ?>
<?php if($_menu): ?>
<div class="nav-container">
    <ul id="nav">
         <!-- HOME BUTTON HACK -->
        <?php $_anyActive = false; foreach ($this->getStoreCategories() as $_category) { $_anyActive = $_anyActive || $this->isCategoryActive($_category); } ?>
        <li class="<?php echo !$_anyActive ? 'active' : '' ?>"><a href="<?php echo $this->getUrl('')?>"><?php echo $this->__('Home') ?></a></li>
        <!-- HOME BUTTON HACK -->
        <?php echo $_menu ?>
    </ul>
</div>
<?php endif ?>