Skip to main content

Loop Builder in Divi 5

Learn how to use the Loop Builder which allows you to construct looping post-based and term-based content using any Divi element.

Updated this week

The Divi 5 Loop Builder is a tool that enables you to display a loop of content from your website’s database (such as posts, products, categories, and authors) and customize the design of each item within the loop.

How to Access the Loop Builder

Divi 5 - Loop Builder
  1. Open the settings of any element (section, row, column, group module, or module) by clicking on the element itself or by clicking on the gear icon.

  2. From the element's settings modal.

  3. Navigate to the Content Tab → Loop.

  4. Enable the Loop Option.

  5. Customize your query.

How to Use the Loop Builder

  1. Build a template for the looped items using Divi elements and design settings.

  2. Customize the query that controls the content in the loop (number of posts, post type, category, etc.).

  3. Insert dynamic content from the loop into your template (such as post title, featured image, excerpt, etc.).

Query Loop Options

Divi 5 - Loop Builder Options
  • Query Type: Choose what you would like to loop, whether posts, terms, or users.

  • Post Type: Choose which post type to loop, such as blog posts, WooCommerce products, Divi projects, etc.

  • Terms: Choose which term to loop, such as categories or tags.

  • Users: Choose which role of users to loop, such as authors or contributors.

  • Include Posts With Specific Terms: Choose to loop through only posts from specific categories and tags.

  • Exclude Posts With Specific Terms: Exclude posts from specific categories and tags from your loop.

  • Include Specific Posts: Include only specific posts in your loop, which is excellent for featuring blog posts or products.

  • Exclude Specific Posts: Exclude specific posts from your loop.

  • Order By – Order your looped items by ascending or descending.

  • Posts Per Page: Choose how many looped items should appear on each page.

  • Post Offset: Display only every n items. This allows you to create multiple loops through the same query, each with a unique set of posts and design.

  • Meta Query: Build custom queries to filter your loop using any post meta key.

    • Meta Key: The meta key in the post_meta table.

    • Meta Value: The value of the item with the specific meta key.

    • Compare: Once you are querying a specific meta key, you can choose how to compare the value to affect the query (e.g., is equal to, is greater than, etc.).

    • Type: The type of value being compared, such as number, date, time, etc.

Loop Builder Pagination

Divi 5 - Loop Builder - Pagination

Similar to the Blog module or Portfolio module, you can also add a pagination system that will display the paginated results of the Loop Builder.

  1. Click on the Add New Module button .

  2. Search for Pagination and click on it to add it to your page.

  3. In the Content Tab → Target → Target Loop, choose the element that the Loop Builder queries. This can be the section, row, column, or module.

Notes:

  1. If the Target Loop is left to the Main Query option (default), it will display the standard Post Navigation.

  2. (optional) Use the Admin Label to set a distinctive label for the element that is looped. This will help to select the correct looped element in the Pagination module.

Custom Field & Post Type Support

Divi’s loop builder supports custom fields in two ways:

  1. You can use custom meta queries to display specific content in your loop based on the posts’ data in the post_meta table, which includes all custom field data.

  2. You can display data from the wp_postmeta table, such as custom field data, within your loop template as content.

Support For Advanced Custom Fields (ACF)

Divi’s loop builder supports custom fields created using Advanced Custom Fields (ACF). When selecting a custom field, you’ll find all ACF fields at the top, which are labeled with their associated field names.

Support For ACF Repeater Fields

Divi’s loop builder also supports ACF repeater fields. If you used ACF to create a query loop, you can select it from the Query Type menu, and everything will fall into place.

Did this answer your question?