WP Menu

This extension to Bricks’ Query Loop allows for easily looping through menu items from any WP menu. Ideal for adding dynamic lists of menu items inside a footer or mega menu dropdown. Any layout can be achieved as the menus can be built with native elements.

Footer built with WP Menu query loops in the Bricks builder, with a Text link using dynamic tags and items in Products, Community and Follow columns

Query type – Select WP Menu from the Extras query type options.

Select Menu.. – Choose the WP menu you wish to get the menu items from.

Menu Items Filter – Choose to display either..

  • All items – Every menu item inside the wp menu, including sub menu items.
  • Top Level Items – Only the very top level menu items, no sub menu items
  • Child Items of Parent – Provide the menu item ID to display only the sub menu items of that menu item.

Nesting Menus

To nest sub menu items inside of a parent menu.. use a nested query loop and inside the nested loop choose ‘child items of parent’ as the Menu Items Filter with the dynamic tag x_menu_item_id as the value. This will populate the sub menus dynamically, as each nested loop will be populated based on if the current menu item ID has sub menu items.

WP Menu query settings for a nested loop: footer menu 1, Menu Items Filter set to Child Items of Parent, and Parent Menu Item ID set to the x_menu_item_id tag
Structure panel showing nested menu loops: a Menu Item loop containing a Label and Sub Menu items loops, each with its own Label

(the outer query loop would be outputting the ‘top level menu items only’, with each inner loop ‘child items of parent’)

Dynamic Tags

Once you’ve looped through the menu items, there’s three new dynamic tags available to get the individual menu item data from in the loop.

x_menu_item_label – Displays the menu item label.
x_menu_item_url – Gets the URL for the menu item link
x_menu_item_description – Displays the menu item description.
x_menu_item_target – _self, _blank depending on the link settings in the WP menu. (useful for adding as a target attribute on the links)
x_menu_item_id – The ID of the current menu item

This content is restricted to BricksExtras users. Login if you already have an account.