-
xiaolin
Hi,
Is it possible to display both an ACF image gallery and an ACF repeater field within a GenerateBlocks 2.0 Query Loop without needing to write any additional custom code? If so, could you show me how to set it up?
Thank you.
-
Hi there,
It should be able to, but I haven’t tested it yet myself.
What it the relationship between the gallery and the repeater? Is the gallery a sub field of the repeater?
Or you can provide your admin login for me to check the structure.
Let me know 🙂
-
xiaolin
Hi
Sorry for the confusion. What i meant is two separated questions
1. I made a Content Template element for a CPT and want to use Text element or Image element to display all images from an ACF gallery field. Is it possible?
2. I also have ACF repeater fields in this CPT so how to display all repeaters content including its subfields?
Thank you
-
Alvind
Hi there,
Both fields are now supported in the V2 Query block. Here’s how to configure them correctly:
ACF Gallery field:
– Add a Query Loop block, set the Query Type to Post Meta, and enter the gallery field name in the Meta Key field.
– Inside the Loop Item block, add an Image block and use the dynamic tag {loop_item key:url} in the Image field.ACF Repeater field:
– Add a Query Loop block, set the Query Type to Post Meta, and enter the repeater field name in the Meta Key field.
– Inside the Loop Item block, add a Text block for each subfield within the repeater. Use the dynamic tag {loop_item key:subfield_name} (replace subfield_name with the actual subfield name). For multiple subfields, add corresponding Text blocks for each. -
xiaolin
Thank you very much it’s working.
I have another scenario using query loop to to display Room CPTs inside Content Template of a Cruise CPT.
Inside each Room block, i also need to display room images (ACF gallery field). Is it doable?
Looks like i need a nested query loop inside?
-
Alvind
Yes, in this case, you need to add another Query block for the Gallery field inside the Room Query block.
- You must be logged in to reply to this topic.