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?

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>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.