1

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?

Altravista
  • 931
  • 1
  • 9
  • 32

1 Answers1

0

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>
Altravista
  • 931
  • 1
  • 9
  • 32