27th Oct '22
/
4 comments

Accessing ACF Repeater Sub Fields Programmatically in Bricks Query Loop

It is possible to output sub field’s values when a Bricks query loop’s type has been set to a ACF Repeater without writing code. This is built-in.

If you are looking to get/output the sub field’s value via code instead, simply using the_sub_field() or get_sub_field() is not going to work [unless we loop through the entire have_rows()].

Here’s how the sub field values can be output in a Code element:

<?php

// get the current row in the loop
$acf_row = \Bricks\Query::get_loop_object();
// print_r( $acf_row );

echo $acf_row['details']; 

?>

Given

and

and

for example, sample output of

print_r( $acf_row );

is:

Array ( [name] => Head Massage [details] => Dolor tempor irure irure aute pariatur. Aliqua mollit cillum ad elit. Elit aliquip fugiat reprehenderit incididunt deserunt. Aliqua qui magna amet proident fugiat ut exercitation exercitation enim sunt velit incididunt pariatur. )

Source: https://forum.bricksbuilder.io/t/acf-repeater-get-sub-field-not-working/7281

Get access to all 610 Bricks code tutorials with BricksLabs Pro

4 comments

Leave your comment

 

Related Tutorials..

Pro
Bidirectional Relationship between a CPT and a Taxonomy of another CPT using ACF in Bricks

Bidirectional Relationship between a CPT and a Taxonomy of another CPT using ACF in Bricks

A couple of members asked: I have a cpt called "Markets" aand a cpt "tools". Tools have a taxonomy "tools group". How can i create…
Color Custom Field as Section Background Color on Category/Term Archives in Bricks

Color Custom Field as Section Background Color on Category/Term Archives in Bricks

How to use a color from a taxonomy term custom field for as the hero section background color on archive pages.
Categories:
Tags:
How to populate a map with dynamic markers from a CPT using ACF in Bricks (PART 1)

How to populate a map with dynamic markers from a CPT using ACF in Bricks (PART 1)

This tutorial provides the PHP & JS codes that can be pasted in order to create a dynamic map with markers populated from a custom…
Categories:
Pro
ACF Options Fields in Bricks

ACF Options Fields in Bricks

This Pro tutorial walks you through outputting the values of custom fields attached to an ACF Pro's Options page in Bricks builder. We shall register…
Categories:
ACF Repeater Sub Field Values as Tabs in Bricks

ACF Repeater Sub Field Values as Tabs in Bricks

Bricks' query loop supports ACF Repeaters and Meta Box Groups out of the box besides posts, users and terms. This tutorial shows how we can…
Categories:
Tags:
Pro
Merging ACF Gallery Images with Featured Image in Bricks

Merging ACF Gallery Images with Featured Image in Bricks

Updated on 12 Mar 2025 In the Bricks Facebook group a user asks: Merging images from different fields into a single gallery Hi, I have…
Categories:
Pro
Custom Dynamic Data Tags for ACF Field Label, Prefix and Suffix in Bricks

Custom Dynamic Data Tags for ACF Field Label, Prefix and Suffix in Bricks

Bricks lacks built-in dynamic tags for ACF field labels, prefixes, and suffixes. This tutorial shows how to add them using custom dynamic tags.
Categories: