How to change default horizontal menu on header?

After setup the module on your site, you should create the menu profile which have Alias = “top-menu“, it will auto show on Header area of your site.

To change the default menu top to load other menu alias, ex: menu-top-default

You should edit the file “/app/code/Ves/Megamenu/view/frontend/layout/default.xml” or copy the file into your template folder “app/design/frontend/Theme Vendor/Theme Name/Ves_Megamenu/layout/“. Then change the code:

<argument name=”alias” xsi:type=”string”>top-menu</argument>

To:

<argument name=”alias” xsi:type=”string”>top-menu-default</argument>

Flush cache of your site to apply change.

The megamenu module also support widget block, widget shortcode to load menu profile on frontend. So you can load it in cms page, create widget instance to load it to any other position.

Notice:

The megamenu menu top block was reference to the block name “store.menu” – this is default block to load catalog navigation on header of default magento 2 theme. If your custom them are using other block, you also should change the layout xml file of the megamenu to reference to right block.

The default code in module layout xml file is:

<referenceBlock name="store.menu">
			<block class="Ves\Megamenu\Block\Menu" name="catalog.topnav" template="Ves_Megamenu::topmenu.phtml">
				<arguments>
					<argument name="alias" xsi:type="string">top-menu</argument>
				</arguments> 
			</block>
		</referenceBlock>

Last updated