WordPress Menu with Submenu Dropdown

The current wp_smart_navwalker does a great job of making top-level menu items but doesn’t do anything to let you create or style sub-menus. The only way I’ve seen to make dropdown submenus (even common single-level ones) easily is to use the Bootstrap framework, and the custom walker Pinegrow built for it. Those of us using Tailwind or no framework are left out in the cold.

Granted, WordPress will create a ul > li > ul for any submenus, but they only have a class of “sub-menu” and don’t carry over any classes or attributes from Pinegrow. It’s easy enough to make CSS rules to take care of basic styles but even doing something like adding an aria-expanded=“false” attribute now has to be done with some janky javascript when the page loads.

The current system also copies the same classes from the ul > li elements to ul > li > ul > li. I know that I like to have different hover styles for submenus, so this is especially problematic.

In my opinion, this is one of the biggest shortcomings of Pinegrow’s theme creation features. I’ve had to rely on 3rd party plugins like Max Mega Menu to make my menus, and I’d love to remove that dependency.

As a side note: The Help button in the Nav Menu action goes to the old documentation site, which is no longer available. Here is a link to the text of the old article that I saved from the wayback machine.


Yes. This is much needed.

1 Like

Yes, we need this. Thinking about it, should be possible to support at least 1 level of dropdowns with Smart walker.

The task has two parts:

  • Updating the PHP Smart menu walker
  • Updating the Menu action to be able to figure out additional template elements

I have to do the 2nd one, but the 1st one is open to any hero who wants to try :slight_smile: Just let us know so that we don’t duplicate the effort.

1 Like

As much as I’d love to try, I suspect it would kick my butt pretty quickly. I’ll have one of my devs take a look though, and put them on it if it seems reasonable.


An aria compliant, keyboard accessible and ability to define svg icons for sub menu items will be awesome to have!

I built a native menu in Pinegrow with Interactions that meets those criteria, I just haven’t done the work to make it work with WordPress yet. I’ll update this post with some sample code later today when I’m at a computer.

Sometime this week I’m going to put my guys on the job to get it working with WordPress, either via semi-ugly CSS or by modifying the WalkerMenu that ships with Pinegrow. I’d prefer a native walker solution but I suspect that it’s going to take a lot of work.

WordPress block themes (FSE themes) have a menu builder built in, but right now they are next to useless. I’m sure the Pinegrow team is keeping an eye on it to see whether there is value in extending their menu builder for classic and hybrid themes or if they should somehow put their efforts into the Block theme way of doing things.


@adamslowe Hi Adam. Thank you for your awesome contribution to the Pinegrow Community. Your videos made me interested in Pinegrow. Do you know if it’s possible to load custom woo templates from a PG plugin not theme? How to edit single post template (block based) from WP Dashboard? - #6 by matjaz

1 Like

Thanks! I’ll be the first to admit that WooCommerce is one of my big weaknesses (I think WP is lousy for most e-commerce applications, to be honest).

Given what I just read, I suspect it wouldn’t work with a PG plugin, but it’s worth testing. You have piqued my curiosity now so I’m going to have to test it in the next few days.

1 Like

FYI: Here is a repository with a sample accessible menu.
Demo accessible menu - https://github.com/adamslowe/pg-accessible-menu

It relies on Tailwind and Pinegrow Interactions.