Nav Menus Custom Query Types in Bricks

Updated on 21 Aug 2024

This Pro tutorial shows how custom query types for each navigation menu can be generated in Bricks.

This enables us to loop through the menu items of any nav menu and visually build menu items' titles/text linked to their URLs with optional descriptions.

Use case: When a footer from a design set like Frames is imported, delete all but the first list item, enable query loop on it, and select the nav menu from the query type dropdown to make the static items dynamic.

Note: All items of the selected menu will appear at the same level regardless of their hierarchy/depth in the menu. If hierarchy is to be maintained with indentation, you may want to use a Nav Menu element instead of this approach.

Step 1

Add the following in child theme's functions.php (w/o the opening PHP tag) or a code snippets plugin:

This is a BricksLabs Pro tutorial.

For full access login below or create your BricksLabs Pro account

Get access to all 526 Bricks code tutorials with BricksLabs Pro

Related Tutorials..

Load more for Query loops in Bricks

Load more for Query loops in Bricks

Did you know that Bricks has AJAX loading for query loop posts on-click out of the box?
Categories:
Pro
Nested Queries in Bricks – Posts Grouped by Published Years and Categories

Nested Queries in Bricks – Posts Grouped by Published Years and Categories

In the past we showed how posts could be grouped by years in Bricks. This Pro tutorial takes it further by grouping posts by categories…
Categories:
Displaying SureCart Featured Products & Products Collections with a Query Loop

Displaying SureCart Featured Products & Products Collections with a Query Loop

We walk through how to use a query loop to display SureCart products, featured products & collections.
Categories:
Pro
Conditionally Outputting Query Loop Item Based on Post Meta in Bricks

Conditionally Outputting Query Loop Item Based on Post Meta in Bricks

Rendering query-loop enabled posts depending on the value of each post's custom field value is tricky because by default, the custom field plugins' functions or…
Categories:
How to add a resizable desktop navbar in Bricks

How to add a resizable desktop navbar in Bricks

This tutorial will show you how to add a "More" menu item when the navbar overflows on desktop.
Categories:
Tags:
Pro
Posts Grouped by Taxonomy Terms in Bricks using BricksExtras’ Dynamic Table and Pro Tabs

Posts Grouped by Taxonomy Terms in Bricks using BricksExtras’ Dynamic Table and Pro Tabs

How to output any post type, with the taxonomy terms as Tab titles and posts inside tables with sortable columns.
Pro
CPT Posts Grouped by Custom Taxonomy Terms in Bricks

CPT Posts Grouped by Custom Taxonomy Terms in Bricks

The steps to set up a Service Category terms loop with an inner Service posts loop in Bricks without writing code.
Categories: