Feeding recent posts with one of the users of ACF multi author field

Hi there,

I’m trying to feed “recent posts” like a block with a respective ACF multi-author field. This multi-author was created quite a time ago as a user field. It has been working for displaying the names of many authors on the single blog template quite well.

Unfortunately, I haven’t been able to get it to function for the bundle of elements in the screenshot using dynamic features of looper provider and looper consumer. How can I achieve that?

Best

Bildschirm­foto 2023-04-05 um 17.14.49|252x108

Hello @burkiburak,

Thanks for writing in! You need to figure out what is the custom field name or the ACF multi-author field name so that you can use it with the dynamic content code to display username/s into your Looper Consumer. You can this use something like: {{dc:post:meta key="the_field_name"}} or {{dc:acf:post_field field="the_field_name"}}.

Hope this makes sense.

Hi @ruenel thanks for your reply.

I saw ACF the tutorial and read this page https://theme.co/docs/acf-pro-and-loopers many times, but I can’t find where I’m committing a mistake.

The name of the ACF field is multiautor
I only need to list the entries of user ID 41.

  1. The ACF multi-author field should be the field type “user”, is that right?

  2. The return format should be “user object”, right?

  3. Parents element above “posts” is set to Looper Provider as Dynamic Content. I tried all the followings inputs:

    {{dc:acf:post_field field=“multiautor” user=“41”}}
    {{dc:post:meta key=“multiautor}}
    {{dc:acf:post_field field=“multiautor”}}

  4. The element under that “post” is set to Looper Consumer + All.

None of them worked.

What I’m doing wrong here?

Your help is appreciated.
Best
Burak

Hey Burak,

In order to help you with your query, we need to check your setup properly. To do that, please give us the following information in a Secure Note.

  • WordPress Login URL
  • Admin level username and password
  • Page URL or Layout Builder name

You can find the Secure Note button at the bottom of your posts.

Thank you.

I already did, thanks.

Hello @burkiburak,

Please give further clarifications as to what you are trying to do here. First, I have checked your “All roads lead to Rome” post and it is created by “Max Krahé”:

I also checked the Multi-Author on this post and I see this:
Screenshot 2023-04-15 at 11.38.54 AM

On the page “Autoren_multitag”, you have a looper with this as the provider:

Now, I was wondering what you want to display on the “Autoren_multitag”. Are you trying to display post items that were created or that Max Krahé is the Multi-Author? If that is the case, you will need to use Looper Query String instead of having this argument:

$meta_query[] = array(
        array(
          'key'     => 'multiautor',
          'value'   => 'Max Krahé',
          'compare' => 'IN'
        )
);

$query = array(
    'post_type'           => 'post',
    'post_status'         => 'publish',
    'order'               => 'DESC',
    'orderby'             => 'date',
    'posts_per_page'      => -1,
    'meta_query'          => $meta_query
);

Kindly check out this thread to know how to get the correct Looper Provider Query String:

Best Regards.

Hi @ruenel,
Exactly, many authors contributed to the entries as co-authors. By using the multi-author tag, I aim to show all the articles either principally or co-written by this person. So I won’t use the core “one person” WP tag for listing anything in this block.

I used the code that you wrote above as Query String (Looper Provider), Doesn’t matter which co-authors name I choose, I ended up seeing the same list of entries, and they are not sorted by the “multiautor” tag.

Thanks for the thread you recommended. Should I be also changing something in my function.php?

Hello @burkiburak,

The Argument code that I pointed out needs to be converted into a query string first BEFORE you can use it in the Looper Provider Query String. You will have to run var_dump( http_build_query( $query ) ); to be able to get the query string: post_type=post&post_status=publish&order=DESC&orderby=date&posts_per_page=-1&meta_query%5B0%5D%5B0%5D%5Bkey%5D=multiautor&meta_query%5B0%5D%5B0%5D%5Bvalue%5D=Max+Krah%C3%A9&meta_query%5B0%5D%5B0%5D%5Bcompare%5D=IN

And also, please be advised that I am giving only the possible argument. I am not sure what king of items you want to display in the Looper.

Hope this makes sense.

Ok, let’s start over.

  1. I want to list the entries from a certain user by using ACF multiauthor field.
  2. How do I run var_dump( http_build_query( $query ) ); ?
  3. Where should I be adding this line?post_type=post&post_status=publish&order=DESC&orderby=date&posts_per_page=-1&meta_query%5B0%5D%5B0%5D%5Bkey%5D=multiautor&meta_query%5B0%5D%5B0%5D%5Bvalue%5D=Max+Krah%C3%A9&meta_query%5B0%5D%5B0%5D%5Bcompare%5D=IN

Hello @burkiburak,

Please check out this thread first:

@kory has explained in detail how to get the query string.

2.) You should add that line along with the argument that I have given in my previous response to get the resulting query string which I also have given already.

3.) This is now your Looper Provider Query String. To have a full understanding of the Looper Provider Query String and how to use it, please check this documentation:

Best Regards.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.