25
votes
Accepted
Magento 2 Navigation Menu not showing
Solution 1 :
You need to have all your categories UNDER the "Default Category". Then they should show.
Solution 2 :
Verify that Default Category Is Active (Enable category = "yes") and "Include ...
14
votes
Varnish top navigation menu gone
I had the same issue, I found a solution for this.
I just removed the ttl attribute from /vendor/magento/module-theme/view/frontend/layout/default.xml and the menu bar appeared again.
13
votes
Magento 2 : How to display the category image in the topmenu
Look at
vendor/magento/module-catalog/etc/di.xml
<type name="Magento\Theme\Block\Html\Topmenu">
<plugin name="catalogTopmenu" type="Magento\Catalog\Plugin\Block\Topmenu" />
</...
12
votes
Accepted
How to add custom link in main menu in Magento 2?
copy file from
vendor/magento/module-theme/view/frontend/templates/html/topmenu.phtml
and put this file in your theme location
app/design/frontend/Vendor/YourTheme/Magento_Theme/templates/html/...
12
votes
How to add custom link in main menu in Magento 2?
Another alternative is to use a new template file via layout xml.
./app/design/frontend/Company/Yourtheme/Magento_Theme/layout/default.xml
<?xml version="1.0"?>
<!--
/**
* Copyright info....
9
votes
Accepted
Magento 2.1: Add custom category attribute to topmenu classes
I know this is an old question but I just worked on a solution for this. So if anyone else is having this issue...
Have a look at the
Magento\Catalog\Plugin\Block\Topmenu
This is where Magento ...
9
votes
Accepted
Magento 2 - Change positions of the navigation submenu
You need to add below css in your custom CSS / LESS file . I think I have already stated you before how to add custom CSS / LESS.
.navigation .level0 .submenu{
top:30px !important; <!-- ...
7
votes
Accepted
Magento 2 - add link with content to top menu
You can add elements to the top menu using the event page_block_html_topmenu_gethtml_before.
Step 1 - So you need to create a module with these files (all the files should be in app/code/[Namespace]/[...
6
votes
Accepted
how to add and customize items in menu/nav bar in header
1) To remove sign up and sign in links edit your default.xml code at below location.
/app/design/frontend/Infortis/base/Magento_Theme/layout/default.xml
Add these lines of code
<referenceBlock ...
6
votes
Accepted
How to add a category in main menu in magento 2
Login to Admin:
Step 1) Click on Catalog >> Categories.
Step 2) Select Category you want to add in main menu. And select "Include in Menu" => Yes
Step 3) Run command php bin/magento cache:...
5
votes
Accepted
Magento 2: How to sort order of custom links nav?
A little bit code modification is need in your code.
Open your di.xml then put sortOrder="-1"
Using this sortOrder="[NumericValue]" tag you can arrange sequesce of execution of plugin for the same ...
5
votes
Magento 2 Navigation Menu not showing
If you have tried all the other solutions and checked all the other basic things (enabled, correct root category...) then I might have the solution for you!
If the category was every removed from the ...
4
votes
Magento 2 - 3rd level menu items collapsed on mobile devices
Okay, I came up with a solution. It may not be ideal, but it works for me. Hopefully somebody will find it useful.
It will depend on the base theme you're using, but first of all I had to comment out ...
4
votes
Accepted
magento2: Increase the dropdown speed of nav-menu
In your theme, make this file:
Your/theme/Magento_Theme/templates/html/topmenu.phtml
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
// @...
4
votes
Accepted
Magento 2: Change design and HTML of menu
I have found the solution so I am answering it.
Menu content in M2 is generated from Block - vendor/magento/module-theme/Block/Html/Topmenu.php
To make changes in HTML structure, we need to override ...
4
votes
Accepted
Add custom css class to each item in Topmenu - Magento 2
Try following code:
app/code/[VendorName]/[ModuleName]/registration.php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,...
4
votes
Accepted
PHP fatal error: Uncaught TypeError: Argument 2 passed to Magento\Catalog\Plugin\Block\Topmenu
Open vendor/magento/module-catalog/Plugin/Block/Topmenu.php
The constructor of this class looks like
public function __construct(
\Magento\Catalog\Helper\Category $catalogCategory,
...
4
votes
Accepted
Magento 2 Overwrites Topmenu.php In Module But Menu Nav Disappears
The categories are added to the menu using a plugin Magento\Catalog\Plugin\Block\Topmenu::beforeGetHtml.
Since you replaced the core block with yours, this plugin does not get executed.
Make your ...
4
votes
Accepted
Magento 2.3 - Topmenu tabs with wrong (cached) 'active' class
From my understanding, there is no perfect solution to this issue. Whatever fix you decide to implement will have its drawbacks.
I think there may also be 2 other techniques that you can use which ...
3
votes
Accepted
Trying to add delay and only on click expansion to menu.js
Add Some CSS tweaks to open menu smoothly with some delay rather than instantly
To add custom CSS/LESS always better to use _extend.less
See detailed answer for using _extend.less https://magento....
3
votes
What Js is deploying inline style to Submenu/Top navigation
The menu is a jQuery UI element.
You can edit its settings by extending the following file in your theme: Magento_Theme/view/frontend/templates/html/topmenu.phtml
it says:
<nav class="navigation" ...
3
votes
How to place top menu to left side bar in magento 2?
When you first install Magento 2 the home page is displayed using the 1 column layout. you should make a custom layout or modify the 2 Column layout to move the catalog.topnav element to the sidebar.
3
votes
Accepted
Magento2 add a cms page link to menu
There is a issue with plugin order
In default Magento already plugin define in vendor/magento/module-catalog/etc/di.xml
<type name="Magento\Theme\Block\Html\Topmenu">
<plugin name="...
3
votes
Accepted
how to call navigation bar in magento 2.2.6
as per screenshot https://prnt.sc/laljiy please put "Outfits", "shops" and "sale" category as child of "default category".
Let me know if it works.
3
votes
Accepted
Magento 1.9 can't find topLinks block
Go to Admin > Port > Porto - Settings Panel > Header Type you find your selected header type.
In that selected type Header 3 for exemple you'll find : <?php echo $this->getChildHtml('...
3
votes
Accepted
How to get sub category of sub category?
1.Please add below method on your block class
public function getSubcategories($categories) {
$array ='';
if($categories->getChildrenCount()>0){
$array= '<ul class="...
3
votes
Accepted
Add a custom navbar menu
You can add the below code in theme default.xml file
<referenceBlock name="catalog.topnav">
<block class="Magento\Framework\View\Element\Html\Link" name="custom.contact.link">
...
2
votes
Accepted
How to get only level 0 menu in Magento 2?
for step by step implementation refer this link, for github code
for only show level 0 categories your template look like
<?php
$categories = $this->getStoreCategories(true,false,true);
$...
2
votes
How to retrive top menu html for all stores using cron
Yes, you can use environment emulation of the specified store
$appEmulation = Mage::getSingleton('core/app_emulation');
//Start environment emulation of the specified store
$initialEnvironmentInfo = ...
2
votes
Magento 2 - 3rd level menu items collapsed on mobile devices
You can add a custom jQuery widget to extend on the lib/web/mage/menu.js, how to do this is described here:
https://devdocs.magento.com/guides/v2.3/javascript-dev-guide/javascript/js_practice.html
In ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
topmenu × 184magento2 × 84
magento-1.9 × 31
menu × 29
category × 28
navigation × 27
magento-2.1 × 15
magento2.3 × 15
toplinks × 10
submenu × 8
module × 7
frontend × 7
blocks × 6
css × 6
header × 6
category-tree × 6
magento-1.8 × 5
overrides × 5
cache × 5
layout × 4
magento2.2 × 4
event-observer × 4
mobile × 4
link × 4
megamenu × 4