How To Create Dynamic Navigation Using Divi 5 Menu Loops

Posted on March 28, 2026 by 1 Comment

How To Create Dynamic Navigation Using Divi 5 Menu Loops
Blog / Divi Resources / How To Create Dynamic Navigation Using Divi 5 Menu Loops

Divi has always connected to WordPress menus through the Menu module. What the new Link module, Dropdown module, and Menu query type in the Loop Builder add is compositional control. Instead of relying on a pre-packaged menu component with a fixed structure and styling constraints, you can now build navigation from individually styleable modules using the same building blocks you use elsewhere in Divi 5.

The Menu query type in the Loop Builder is the other key ingredient. A Link module can be looped against a WordPress menu so it repeats once per menu item and dynamically pulls in each itemโ€™s text and URL. Add, remove, or reorder items in Appearance > Menus, and the navigation updates without requiring changes in the Visual Builder.

There is one current limitation to keep in mind: Divi 5โ€™s new menu looping does not yet provide a complete one-loop solution for top-level items and nested sub-menu items together. These new modules and the Menu query type still provide a strong foundation, but for now, building dropdown navigation works best with a hybrid approach. Because of that, this tutorial covers two practical patterns: one for flat navigation driven entirely by a single menu loop, and one for navigation with dropdowns where the top level is built manually and each dropdownโ€™s links are looped from a dedicated WordPress menu.

Before You Start: Set Up Your WordPress Menus

Go to Appearance > Menus and create the menus you want to loop. For flat navigation, a single menu containing all top-level items is enough.

WP Menu Setup

For dropdown navigation, create a separate menu for each set of dropdown links you want to output dynamically. In this tutorial, the โ€œServicesโ€ menu contains only the links that appear inside the Services dropdown.

WP Menu Setup Dropdown nav

One last note before we start: this article focuses on the new modules, loop settings, and basic semantic structure. To stay on topic, it does not cover styling or building a broader design system for navigation. For that, refer to the detailed guidance on Design Variables and Nested/Stacked Presets.

Flat Navigation Driven by a Single Menu Loop

This structure works well for navigation with no dropdowns. One Link module, configured as a loop template, handles the entire menu. Add or remove items in WordPress, and the navigation updates automatically.

Example Flat Navigation

Structure

Open a Global Header template in the Theme Builder.

Use this structure: Section > Row > Column containing an Image module for the logo, a Group module with a single Link module inside it, and a Button module for a CTA. In the Columnโ€™s Design > Layout settings, set the layout to Flex, set Layout Direction to Row, Justify Content to Space Between, and Align Items to Center.

Column Flex Layout Options

On the Group module, use these flex settings: Justify Content set to Space Between and Align Items set to Center.

Group Module Layout Flex Settings

The Link module inside the Group will serve as the loop template and output all menu items.

Flat Nav Module Structure

Loop Settings

Select the Link module inside the Group. In the Content tab, open the Loop option group. Toggle Loop Element on, set Query Type to Menu, then select your primary navigation menu in the Menu field. Set Order By to Menu Order and Order to Ascending so the output matches the order you set in WordPress.

Link Module in Flat Nav set to Loop

Set the Link moduleโ€™s text field to pull dynamic values from the menu item so each repeated instance uses its own label. Use Loop Menu Text.

Flat Nav Link Text Dynamic Data to Menu Text

Do the same for the link destination by setting the Link field to use Loop Menu Link.

Flat Nav Link Link Dynamic Data to Menu Link

Semantics

Work through each layer from the outside in.

Row: In the Advanced tab, set the HTML element to <nav>.

Flat row element type nav

Then open Attributes and add aria-label=โ€Main navigationโ€.

flat row aria label

Column: In the Advanced tab, set the HTML element to <ul>.

flat column element type ul

Image Module: In the Advanced tab, set the HTML element to <li>.

flat image element type li

Group Module: In the Advanced tab, set the HTML element to <ul> and wrap the Group in a <li> using HTML Before and HTML After.

flat group element type ul and html before after li

Link Module: In the Advanced tab, set HTML Before to <li> and HTML After to </li>.

flat menu link module html bfr aftr li

Button Module: In the Advanced tab, set HTML Before to <li> and HTML After to </li>.

button html beforeafter li

With this setup, you have a simple, accessible header powered by a WordPress menu.

Navigation with Dynamic Dropdown Menus

This structure works well when some top-level items reveal a sub-menu. The top level is built manually, which gives you control over which items exist and which of them open dropdowns. Each dropdownโ€™s links are then looped from a dedicated WordPress menu.

Example Dropdown Navigation

Structure

The outer structure and layout settings for the Row, Column, and Group are the same as in the flat navigation example above.

The change happens inside the Group module. Add a Link module for each top-level navigation item and manually configure each itemโ€™s text and URL. For any item that opens a dropdown, such as Services in this example, nest a Dropdown module directly inside that Link module. Inside the Dropdown, place a single Link module. That nested Link module becomes the loop template for the dropdown items.

dropdown menu module structure

For both the Group and the Row, use Flex layout with Layout Direction set to Row, Justify Content set to Space Between, and Align Items set to Center.

Dropdown menu Group flex layout settings

These settings allow your top-level Link modules to display horizontally, while the row-level layout distributes the logo, navigation, and CTA across the header.

Dropdown menu column flex layout settings

Loop Settings

Select the Link module inside the Dropdown. In Content > Loop, toggle Loop Element on, set Query Type to Menu, and select the sub-menu for that dropdown, โ€œServicesโ€ in this example. Set Order By to Menu Order and Order to Ascending. Repeat this for each dropdownโ€™s Link module template.

Loop Settings for Dropdown menu submenu links

Inside that looped Link module, set the text to Loop Menu Text and the destination to Loop Menu Link so each repeated dropdown item outputs the correct label and URL.

Semantics

The outer layers follow the same pattern as the flat navigation. The additions here are specific to the trigger links and dropdown containers.

Row, Column, Image Module, and Button Module: Apply the same element, attribute, and HTML Before/After settings used in the flat navigation example above. The remaining changes apply to the dropdown-specific elements.

Manual top-level Link Modules (for example, Home, About, and Contact): In the Advanced tab, set HTML Before to <li> and HTML After to </li>. Because these top-level links are not looped, you need to apply this to each one manually.

Dropdown menu top level link modules html beforeafter li

Top-level Link Modules that trigger a dropdown: In Attributes, add aria-haspopup=โ€trueโ€. If your implementation includes a persistent open/closed state, also add or update aria-expanded to reflect that state.

Dropdown Link Module haspopup true

Dropdown Module: In the Advanced tab, set the HTML element to <ul>.

dropdown element type to ul

Then, in Attributes, add role=โ€menuโ€.

dropdown role menu

Looped Link Module inside the Dropdown: Set HTML Before to <li> and HTML After to </li>.

dropdown submenu link module html b4 aftr li

This setup takes a little more effort because there is more nesting, but it gives you a practical way to combine Divi 5โ€™s modular menu building with dynamic WordPress-driven dropdown content.

Customize Your Menus In Divi 5 Today

With either structure in place, looped menu changes happen entirely in Appearance > Menus. The flat navigation will automatically reflect menu additions, removals, and reordering. In the dropdown version, each loop inside a Dropdown module updates from the WordPress menu assigned to that specific dropdown.

This is already a major step toward a more modular menu-building experience in Divi 5, and it pairs especially well with Design Variables and Presets once youโ€™re ready to style the system consistently across your site.

Divi Marketplace

Are You A Divi User? Find Out How To Get More From Divi! ๐Ÿ‘‡

Browse hundreds of modules and thousands of layouts.

Visit Marketplace
Divi Marketplace
Divi Cloud

Find Out How To Improve Your Divi Workflow ๐Ÿ‘‡

Learn about the new way to manage your Divi assets.

Get Divi Cloud
Divi Cloud
Divi Hosting

Want To Speed Up Your Divi Website? Find Out How ๐Ÿ‘‡

Get fast WordPress hosting optimized for Divi.

Speed Up Divi
Divi Hosting
Premade Layouts

Check Out These Related Posts

Divi 5: Semantic Elements vs Role Attributes

Divi 5: Semantic Elements vs Role Attributes

Posted on March 26, 2026 in Divi Resources

In an era where WCAG compliance, semantic HTML, and AI-assisted search experiences matter, modern website builders are evolving to make accessibility and meaningful structure standard rather than an afterthought. Divi 5 is part of that shift, making it easier for Divi users to build sites with...

View Full Post
The Optimal Divi 5 Workspace Setup For Power Users

The Optimal Divi 5 Workspace Setup For Power Users

Posted on March 25, 2026 in Divi Resources

When you’re building complex sites, a few deliberate adjustments to your environment can save hours each week by reducing friction and keeping you focused on the work that matters. Divi 5 makes this easier with workspace tools that adapt to how you work instead of slowing you down. In this...

View Full Post

1 Comment

  1. I have been testing the new link module and drop down module, but I donโ€™t know how to show the hamburger menu on tablet and mobile, how can do accomplish this?

Leave A Reply

Comments are reviewed and must adhere to our comments policy.

Join To Download Today