2

I am struggling to add a non-category custom menu in the navigation bar and also a sub-menu. Please help. Thanks.

2

4 Answers 4

1

For people looking for a solution, I was facing the same issue, but after some research I found an event the Block which generate the menu. I also found another stack exchange response which worked for me.

https://magento.stackexchange.com/a/212369/50805

0

one alternative solution is that

create one new category and assign cms block to it

and add cms page code to that cms block

everything works as per you needed.

0

You can try this way:-

Extend this file from core:-

app/design/frontend/<vendor_name>/<theme_name>/Magento_Theme/templates/html/topmenu.phtml

<nav class="navigation" data-action="navigation">
    <ul data-mage-init='{"menu":{"responsive":true, "expanded":true, "position":{"my":"left top","at":"left bottom"}}}'>
        <?php /* @escapeNotVerified */ echo $_menu; ?>
        <?php /* @escapeNotVerified */ echo $block->getChildHtml(); ?>
        <li>Test menu</li>
    </ul>
</nav>

It will add a menu in the end.

1
  • this returns nothing. however, on switching to Luma theme, navigation is displayed Commented Jan 7, 2021 at 11:53
-1

Please find the below code for Main menu and submenus.

<?xml version = "1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="../../../Backend/etc/menu.xsd">
    <menu>
        <!--Main Menu-->
        <update id="Arise_Extensions::menu" title="Arise Extensions" module="Arise_Contact" sortOrder="10"
                resource="Arise_Extensions::menu"/>
        <!-- Sub Section 1 -->
        <add id="Arise_Contact::contacts_manager" title="Arise Contacts" module="Arise_Contact" sortOrder="10"
             parent="Arise_Extensions::menu" dependsOnModule="Arise_Contact"
             resource="Arise_Contact::contacts_manager"/>
        <!-- Sub Section 1 Links-->
        <add id="Arise_Contact::manage_contacts" title="Manage Contacts" module="Arise_Contact" sortOrder="10"
             parent="Arise_Contact::contacts_manager" action="Arise_contacts/manage_contacts"
             resource="Arise_Contact::manage_contacts"/>
        <add id="Arise_Contact::Arise_contacts_settings" title="Manage Contact Settings" module="Arise_Contact"
             sortOrder="20" parent="Arise_Contact::contacts_manager"
             action="adminhtml/system_config/edit/section/Arise_contacts"
             resource="Arise_Contact::Arise_contacts_settings"/>
        <!--/Sub Section 1 Links-->
    </menu>
</config>
1
  • I want to add the menu item in the home page navigation bar in the frontend, not in the backend. :)
    – Mudz7
    Commented Feb 16, 2018 at 6:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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