Limit Bricks Users Query to Current Post’s User-type ACF Field Value

Consider this scenario with ACF:

  • CPT: movie
  • Movie Fields field group
    • Author field of User-type
    • Field group location: Post Type = Movie
  • Author Fields field group
    • Author Title custom field of Text-type
    • Return Format: User ID
    • Field group location: User Role = Author

"John Briley" user:

"Gandhi" movie:

The requirement is to show John Briley as the author when Gandhi movie item is being viewed on the front end followed by a hyphen and John Briley's Title.

This Pro tutorial shows how this can be done in Bricks.

Create a template named say, "Movie" of type Single.

Edit it with Bricks.

Apply it to movie CPT.

Add a Section having Post Title and Post Content.

Add another Section having "Author" h2 Heading and a Container > Block.

Enable query loop on the Block.

Type: Users
Roles: Author

Add a Basic Text inside the Block having:

{wp_user_display_name} - {acf_author_title}

This should show all author users in the site. We need to filter this list to only the author that matches the current post's author post meta.

This is a BricksLabs Pro tutorial.

For full access login below or create your BricksLabs Pro account

Instant access to 390+ Bricks code tutorials with BricksLabs Pro