Create custom fields for user (author) and call them onto a blog post

I created custom fields in order to create social links and a job title for the author section inside my blog post. I did this using acf but this issue I’m having is that the data being called doesn’t match up with the corresponding author. Hopefully the screenshots will explain better, and you can understand.






If I increase the quantity to two, then it shows the correct one, but I’m not able to do it with just one.

Hey Brayden,

you don’t need to use a query loop for this. You can simply use the following dynamic tags in a regular text element within your blog post template:

{echo:get_the_author_meta(user_role)}
{echo:get_the_author_meta(user_linkedin)}

Backend:

Frontend:

If you want or need to use the query loop make sure to only fetch the current author using the bricks/users/query_vars hook:

add_filter( 'bricks/users/query_vars', function( $query_vars, $settings, $element_id ) {
    if ( $element_id === 'YOUR_QUERY_LOOP_ELEMENT_ID' ) {
        if ( $author_id = get_the_author_meta( 'ID' ) ) {
            $query_vars['include'] = [ $author_id ];
        }
    }

    return $query_vars;
}, 10, 3 );

Let me know if that helps.

Best,

André

1 Like

Thank you so much André, this worked perfectly!