SOLVED: How to display multiple related parts in a single template

Hi!, I am putting together a website for high school students to upload practical work on various topics. Each Work is made up of multiple Parts such as videos, audios, pdf and images.
Concretely in Wordpress, each Work is a CPT with a custom field of type ACF-relationship to its parts. Each part has a name, a link to the video or a wp_attachments for images, audio and pdf, as appropriate.
However I am not able to show all parts in a single template for each work.
In brief, I have CPT called “W” with an multiple ACF relationship to another CPT called “P”, where “P” has video_url o attachment. I need to show single template for CPT “W” and list all “P” videos (as embeds) and attachments.

A simpler scenario may be to having a Parent with several Childs and to try to show all the ages of each child in the person template.

I would appreciate any guidance. Thanks in advance!
Ariel

Hello @ariel

Did you try the Bricks 1.4-RC version? This release includes the integration between the Query Loop and the ACF Relationship field, meaning, you can set a custom query where you pick the ACF Relationship field as the query type. Bricks will loop through each post added to the ACF Relationship field.

Read more on Bricks roadmap: Changelog – Bricks

Hi Luis, thank for you answer. I am trying with 1.4rc in a new template that applies to single and post_type==Work.
Firstly, I can print the title of all Work.Parts with a Metadata block but I can not customize how each Part is printed.
Secondly, I tried with query-loop in a container Element, filtering only Posts of type “Parts”, but here I can’t filter for the Work that contains them. It prints all the Parts of all the Works.

I think I am missing something. Can you show me a screenshot of how to “pick the ACF Relationship field as the query type.” or at least give the steps to test it?
Thanks again,
Ariel

Hello @ariel

You should see in the query type control the list of the ACF Repeater fields:

Screenshot 2022-05-11 at 12.34.53

Hi @luistinygod, I think I found the issue. I don’t have a relationship>relation field but a relationship>post object field with multiple values (see screenshot)

Both fields works similar but If I change post-object with relation, bricks works fine. Maybe this should be a feature request?

Is there any way to control/filter what related items should be shown? i.e al related authors sorted by lastname, first 10 related authors, etc.
Thanks again!

1 Like