How can I edit top navigation menu? Is it possible to add new menus at top? And is it possible to delete some menus from top?
If you are talking about the Catalog Navigation this link will be helpful for you:
https://docs.magento.com/m2/ce/user_guide/catalog/navigation-top.html
If you are taking about header links you can add new links by create below files:
app/design/frontend/vendor/theme/Magento_Theme/layout/default.xml
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceBlock name="header.links"> <block class="Magento\Framework\View\Element\Html\Link" name="custom-link"> <arguments> <argument name="label" xsi:type="string" translate="true">custom link</argument> <argument name="path" xsi:type="string" translate="true">customlink</argument> </arguments> </block> </referenceBlock> </body> </page>
If you want to remove any link:
Add default.xml file in this path
app/design/frontend/vendor/theme/Magento_Theme/layout/default.xml
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceBlock name="register-link" remove="true" /> <!--for Create Account Link--> <referenceBlock name="authorization-link" remove="true" /> <!--for Sign In Link --> <referenceBlock name="wish-list-link" remove="true" /> <!--for WishList Link--> <referenceBlock name="my-account-link" remove="true" /> <!--for My Account Link--> </body> </page>
Hope it will be helpful for you
"app/design/frontend/vendor/theme/Magento_Theme/layout/default.xml"
should it be "app/design/frontend/Magento/theme-frontend-luma/Magento_Theme/layout/default.xml" ? (if i want to customize luma theme)
Yes, you can edit this and then flush cache and check if it works for you.
Or if you have a custom module you can also place default.xml in your custom module and update it the file path will be something like this:
app\code\MyModule\Custommodule\view\frontend\layout\default.xml
in this file you can place the same code which I have shared in my previous answer.
"app/design/frontend/vendor/theme/Magento_Theme/layout/default.xml" what is vendor and theme here?
Can you post example code to do this with custom module?
Here vendor is Vendor's Name i.e Company's Name who is creating this custom theme and "theme" keyword is representing the name of Theme.
If you want you can also create your own theme under app/design/frontend/companyname/themename/....
If you have already created custom module under app/code then you can place the default.xml, in my case the path is:
app\code\Aman\Custom\view\frontend\layout\default.xml
and the code I have added is:
<?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceBlock name="header.links"> <block class="Magento\Framework\View\Element\Html\Link" name="custom-link"> <arguments> <argument name="label" xsi:type="string" translate="true">New Link</argument> <argument name="path" xsi:type="string" translate="true">new-link</argument> </arguments> </block> </referenceBlock> <referenceBlock name="register-link" remove="true" /> </body>
If you want to learn how to create custom module in Magento 2 you can have a look on this link:
http://inchoo.net/magento-2/how-to-create-a-basic-module-in-magento-2/
Hi there,
Maybe you are facing some problems with traditional Magento menu?
You seem to be not very good at coding when asking this question.
We do understand your situation. Thus, we provide you with a Magento 2 mega menu - Ninja Menus that can absolutely help!
Edit top navigation menu at a glance with the intuitive drag and drop interface. No coding need!
Plus, wanna add new menus at the top? With our widget features, you can add them to anywhere in your storefront.
Check out the below links to see how amazing Ninja Menus:
https://www.youtube.com/watch?v=HPan7HtIYOw
By adding Magento 2 Mega Menu Extension you can do that. It helps you to create a menu fast and easily in Magento 2 . It allows you to have multiple options to show what you want on the main navigation.
MEGA MENU 2 - FEATURES
Hi there,
by way of a workaround (that works) try using a server redirect:
1/ make a category and add it to the menu and note down its URL
2/ add a redirect to the .htaccess file to go to where you want it to go instead.
redirect 301 /servicing.html /servicing-and-maintenance
hope this helps someone in the future!
L