I have add a custom link to main menu in this way Adding a non-category link to the navigation links in magento 2
but how can i put this link BEFORE catalog menu link position?
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityI have add a custom link to main menu in this way Adding a non-category link to the navigation links in magento 2
but how can i put this link BEFORE catalog menu link position?
the easy way: override file topmenu.phtml on your custom theme
vendor/magento/module-theme/view/frontend/templates/html/topmenu.phtml
and if you like you can call cms custom block from admin
<?php $columnsLimit = $block->getColumnsLimit() ?: 0; ?>
<?php $_menu = $block->getHtml('level-top', 'submenu', $columnsLimit) ?>
<nav class="navigation" data-action="navigation">
<ul data-mage-init='{"menu":{"responsive":true, "expanded":true, "position":{"my":"left top","at":"left bottom"}}}'>
<?php
echo '<li class="level0 nav-2 level-top ui-menu-item" role="presentation">';
echo $block->getLayout()
->createBlock('Magento\Cms\Block\Block')
->setBlockId('ea_before_topmenu')
->toHtml();
echo '</li>';
?>
<?= /* @escapeNotVerified */ $_menu ?>
<?= /* @escapeNotVerified */ $block->getChildHtml() ?>
</ul>
</nav>