Change submenu markup

I've seen people recommending to edit the wordpress default Walker to change the menu markup and create your own.

The problem with this is that I would like to change the markup of the submenu and leave the menu as it is.

In the walker function I only saw the functions start_lvl and end_lvl regarding the submenu creation. The functions itself lack of very useful comments... so I understood that lvl means "level" and with that they mean "sub-menu"...

But it doesn't seem to be any specific function to render the submenus. It seems they use the same one for the parent menu than for the submenu.

Any recommendation? I would like to create a menu like this and I'm having troubles.

Topic walker sub-menu templates menus themes Wordpress

Category Web


The whole idea of a custom walker class is that you can customize the menu in detail. So, you can also leave the main menu as it is and build the submenus the way you give in the image.

However, as Hareesh indicates in the comments, this does require quite a lot of customization, especially if you want you theme to be widely applicable (meaning you'll have to take into account errors, such as missing images in the submenu). This might be a nice place to start understanding the walker class.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.