How can I add a Menu item in Magento 2 default Luma Theme ?

enter image description here

  • 1
    You can create child category or default category and then, it will display there. – Rohan Hapani Aug 9 '19 at 4:13
  • Thanks @RohanHapani. What should I do if I would like to add a Static word ? – abu abu Aug 9 '19 at 4:18

Static menu is not good practise. You should create sub menu in default category.

But, For static menu you need to overrride topmenu.phtml at app/design/frontend/<vendor_name>/<theme_name>/Magento_Theme/templates/html/

You can copy from your vendor/magento/module-theme/view/frontend/templates/html/topmenu.phtml and paste in your theme phtml like below way :

 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.

// @codingStandardsIgnoreFile

 * Top menu for store
 * @var $block \Magento\Theme\Block\Html\Topmenu
<?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"}}}'>
        <?= /* @escapeNotVerified */ $_menu ?>
        <?= /* @escapeNotVerified */ $block->getChildHtml() ?>
        <li class="level0 nav-7 category-item last level-top ui-menu-item" role="presentation">
            <a href="#" class="level-top ui-corner-all" id="ui-id-8" tabindex="-1" role="menuitem">
                <span>New Menu</span>
| improve this answer | |

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.