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.

SCR 20240821 jqpa

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.

SCR 20250922 ocmt
structure

(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.