6th Sep '24
/
3 comments

Sub Field Value from the Last ACF Repeater Row in Bricks

A user wrote:

I am using the Bricks Extras dynamic table to pull posts out of a CPT.

These posts contain a repeater with sub-fields and I want to extract the value of a specific field in the last row.  I don't want to loop through the rows, I just want the value of a field in the last row.

This Pro tutorial shows how we can pull the value of a specific sub field of a specific ACF Pro's Repeater field and output that in Bricks.

Consider an ACF Repeater called "Builders" populated on a post like this:

Now the requirement is to show the name of the last builder for this post.

After implementing the tutorial:

Step 1

Register your custom field group if you haven't already for your post type.

Edit your posts and populate the Repeater field.

Step 2

Add the following in child theme's functions.php (w/o the opening PHP tag) or a code snippets plugin:

This is a BricksLabs Pro tutorial.

For full access login below or create your BricksLabs Pro account

Get access to all 610 Bricks code tutorials with BricksLabs Pro

Related Tutorials..

Pro
ACF Relationship: Show all other events related to the artists of the current event

ACF Relationship: Show all other events related to the artists of the current event

How all other events related to the artists of the current event can be output in a Bricks query loop.
Categories:
Pro
Configuring Image Gallery dynamic source in Bricks

Configuring Image Gallery dynamic source in Bricks

Let's say you have a custom field created with ACF Pro of the type Gallery called "Property Gallery" for posts of "Property" CPT. In the…
Pro
Random images from ACF Options Gallery in Bricks

Random images from ACF Options Gallery in Bricks

This Pro tutorial provides the steps to output images from an ACF Gallery-type custom field in a Bricks query loop randomly with each image appearing…
Categories:
Pro
ACF Taxonomy Field Value in Single Posts

ACF Taxonomy Field Value in Single Posts

Consider this scenario: CPT: Movie Movie CPT Taxonomy: Movie Genre Movie Genre Taxonomy's field: Genre Color Each movie will have only genre set. The requirement…
Categories:
Tags:
Custom Function for ACF Link Field

Custom Function for ACF Link Field

How to output the label of an ACF link field through Dynamic Data.
Categories:
Tags: