How To Create Dynamic Navigation Using Divi 5 Menu Loops

Posted on March 28, 2026 by 9 Comments

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

4 Grid Styles For Divi 5 (Free Download!)

4 Grid Styles For Divi 5 (Free Download!)

Posted on April 20, 2026 in Divi Resources

Divi 5 makes it easy to build clean, visually engaging layouts with more structure and variety. In this free pack, you’ll get 4 Styled Grid Layout Designs that are perfect for landing pages, portfolios, featured content sections, editorial layouts, business pages, and more. Each one gives you a...

View Full Post
Queueing Commands In Divi 5 To Build Your Layouts

Queueing Commands In Divi 5 To Build Your Layouts

Posted on April 19, 2026 in Divi Resources

Building a new section on a site with an established design system is where Divi 5‘s Command Center becomes especially useful. On a site without presets, creating a new section usually means two separate tasks. First, you build the structure. Then you open the settings panel and apply the...

View Full Post
Semantic Links vs Dynamic Click Areas In Divi 5

Semantic Links vs Dynamic Click Areas In Divi 5

Posted on April 18, 2026 in Divi Resources

Links are the connective tissue of the web. When they are built correctly, they help users move through content, give search engines clearer signals about page relationships, and provide assistive technologies with predictable navigation. When they are built poorly, they can create friction for...

View Full Post

9 Comments

  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?

    • Hi Alex, I think you can just add an icon module and use interactions to show or hide a popup menu with a replica of your custom menu inside

  2. I really loved the menu loop feature when you add it guys but there is a big issue with it: using the custom loop were are loosing dynamic classes like “current item” for menu behavior that is pretty standard nowadays.

    There is a way to have this working with the loop menu?
    Thank you very much for your awesome work with Divi!

    Best regards

    • Hey Carlo, we’re still working on Divi’s final form of custom menu building. We’re adding it layer by layer, starting with the most fundamental and working from there. Active page/menu item styling is something on our radar and definitely something to look forward to.

  3. This is an interesting approach in creating a navigational menu.
    Question: Using the tag in the Group and Button modules displays a “•” in the menu (I’m referring to the steps in the Flat Navigation section of this article). Is there a way to hide that marker?

    • Good catch. You can look at this post about exploring semantic lists in another way (and I Have the answer there). However, you’d want to include list-style: none; on that element. This is how you can have the semantic element + not have the automatic browser styles applied to it.

      • Thanks for the response – I’ll re-read that pertinent section in the semantics article.

  4. I really like this idea! It’s unfortunate that you have to manually set the top links in the menu for every dropdown. I wish you could just loop the link+dropdown, and it could dynamically just pull from 1 menu. That would save a lot of work!

    • For sure, but baby steps!

Leave A Reply

Comments are reviewed and must adhere to our comments policy.

Join To Download Today