This members-only tutorial provides the steps to add a User-type of custom field using Advanced Custom Fields for a Custom Post Type and output the linked user's display name, avatar/custom image, bio description and a link to that posts authored by that user for each CPT item on the CPT archive.
Create a ACF field group having a User-type of field named say
Leave the Return Format as User Array.
Set the group to appear for your CPT (
staff in this example).
Edit your CPT items and select a user for each.
Time to define some custom functions that returns
- the specified key from the user field's returned array
- URL of the avatar/custom image from the ID of the selected user for the post (CPT item, in this case)
Install and activate a code snippets plugin like WPCodeBox.
Add the following PHP code on the frontend:
This is a premium members-only content.
To view the rest of the content, please sign up for membership ($47/month or $599 one-time).
Already a member? Log in below or here.