Bricks query loops
A Bricks Query Loop repeats an element for each item in a list. With VX, the list can be a field on the current entry: one card per team member, one image per gallery photo, one card per related Writer.
Choose the source
Enable Query Loop on an element, then pick a VX field as the query type.
| To get | Loop over | Inside the loop |
|---|---|---|
| One card per repeater row | The Repeater | {vx_team_name} is this row's name |
| One element per image | The Gallery field | Image elements receive this item |
| One element per file | The Files field | Bind the file's link and title yourself; nothing is bound for you |
| One card per related entry | A relation that allows several items | VX tags and Bricks' native tags read the related entry |
To show all gallery images in one element, don't loop at all: put {vx_gallery} on an Image Gallery or Carousel element.
Single relations and single images aren't lists, so they aren't loop sources.
Related entries
When you loop over a relation, each item is a real post, term or user. That means Bricks' own tags, like the post title and featured image, work inside the loop alongside VX tags.
Nesting
Loops can be nested: loop over team members, and inside each card loop over that member's links. Each level keeps its own item.
Don't nest two loops over the same field. The inner loop takes over.
A Gallery inside a repeater row returns all of that row's images. To show them one at a time, nest a second query loop with the gallery as its source.
Technical details for LLMs
- Loop sources are registered as Bricks query types from the VX catalog (
loops.php): multi relations (posts, terms, users), media lists (gallery) and list nodes (repeater). - Files, Field Table, Content sections and Recurring Date lists register as query types too.
- Inside a relation loop, Bricks' loop object is the related
WP_Post/WP_Term/WP_User, so native dynamic data resolves against it.