14th Dec '24
/
0 comments

ACF User Field Bricks PHP Query

In the Bricks Facebook group a user asks:

my end goal was to create a set of cards that would display the Users that are in an ACF User field as a set of cards for my employee directories.

This Pro tutorial provides the steps to set the Bricks query type to the built-in Users, enable the PHP query editor and add the PHP code for setting include parameter to an array of selected user IDs for the current post.

CPT: department

Custom field: staff_members (user) with Select Multiple enabled and Return format of array.

When editing a specific Department post:

After implementing the tutorial:

Step 1

Edit single Department template with Bricks.

Inside a Section's Container, add a Block and enable query loop.

Enable PHP query editor and paste:

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
Google Maps JavaScript API in Bricks

Google Maps JavaScript API in Bricks

This Pro tutorial provides the steps to show post-specific maps with custom marker content in Bricks using Google's Maps JavaScript API and Advanced Custom Fields.…
Categories:
Pro
Limit the Number of Posts in a Bricks Query Loop of Relationship Type

Limit the Number of Posts in a Bricks Query Loop of Relationship Type

Updated on 12 Dec 2023 Bricks Query Loop popup does not have a control for setting the number of posts to be output when the…
Pro
Adjacent Posts Bricks Query Loop

Adjacent Posts Bricks Query Loop

This Pro tutorial provides the steps to customize a posts query loop in Bricks to show previous and next posts on single post pages. The…
Categories:
Pro
Related Posts using ACF Post Object in Bricks

Related Posts using ACF Post Object in Bricks

Modifying the query loop to limit the posts to only related posts via an ACF Post Object custom field.
Categories:
Tags:
Pro
Displaying Gallery of SureCart Product Images with Bricks’ Query Loop

Displaying Gallery of SureCart Product Images with Bricks’ Query Loop

Custom query loop for looping through SureCart product images.
Categories:
Tags: