Version 3.2 introduced the new query loop for the uiBuiler. This a powerful feature that not only allows you iterate over posts and pages but also over users and sites (multisite only)

Overview

The query loop can be enabled on any block, just click on the block you want to apply it to and navigate to the block settings.

Once enabled, you will be given several options to customise your query. The type switch allows you to switch between querying users, posts or sites and the options will update depending on the type of query.

It is also possible to sort the order of the items queried as well as custom meta queries to given you complete control over the items displayed.

The query builder also allows you to enable pagination and search capabilities to these queries. It’s important to note that pagination does not work if you set an offset value, this is expected WordPress behaviour.

It is not yet possible to edit the style of the search and pagination options within the builder without custom css or by changing the theme style variables.

Query loop and dynamic data

The query loop is designed to work perfectly with the dynamic data. Adding variables from the query list of dynamic data allows you to display data about the posts or users being looped. There are a long list of options like post title, post link, post status as well as options for display custom meta data using the {{meta:key}} variable. So for example, if your post has a meta field called my_custom_key you can write {{meta:my_custom_key}}

Behaviour

When not in preview mode, the builder will render the query after the original block to allow for continued editing. When in preview mode or outside of the builder, only the query will be visible.