Skip to main content

Loops

One of powerful use cases for utilizing Dynamic Data is to loop through a set of data. This can be useful for displaying a list of items, such as posts, pages, or custom post types.

In Nectarblocks, you have two main ways to loop through data and render a list of items with Dynamic Data:

  1. Using the Post Grid Block
  2. Using the Query Loop block

The Post Grid Block

The Post Grid block allows you to display a grid of posts. It’s the easier of the two options, with the layout for all items handled automatically based on the block settings. We recommend this option for most use cases unless you need more control over the layout of the items.

Post Grid Display

You can select your desired post type to pull from, and choose the content to display in each item via the Content tab. This tab acts as a repeater for common attributes and also allows custom fields to be added for additional dynamic data.

Post Grid Block Dynamic Data

Creating an Archive Template

The Post Grid block is a powerful way to create Archive Templates for your posts, or custom post types. To learn more about how to create an archive template, please refer to the Templating documentation.

The Query Loop Block

The Query Loop block is a powerful block provided by WordPress that allows you to loop through a set of data and render a list of items. It is a flexible block that can be used to display a list of items from a variety of sources, such as posts, pages, or custom post types.

In Nectarblocks, you can use the Query Loop block to loop through a set of data and pull data from any of the Nectarblocks Data Types.

Wordpress Query Loop Block