ACF Gallery with Query Template

Hi!
I have a “Works” CPT and I created a template for it. Inside this CPT, I have an ACF Gallery with the field name “project_gallery” where I can upload all the images for that particular post (Works). Now, I want to display all those images with the Query Template (with the grid layout I want). How should I do it?

I appreciate your feedback.

Cheers,
Jornes

Hi @jornes,

what about the Cwicly Gallery Block?

Bildschirmfoto 2023-09-08 um 10.13.33

@Jonas Thanks for the comment!
Can I display images from the ACF Gallery with this? I’ve never tried it yet.

Yep. It’s very easy to do. You also can chose between a regular Grid or Masonry.

1 Like

@Jonas Thank you!
I’ve just tested it. But, with this gallery block, I am unable to design the grid layout I want for the gallery. Is there any way I can display the images in the ACF Gallery using the query template?

I don’t think so. For this you might want to use the ACF repeater field together with the repeater block.

Thanks! I haven’t yet tried the ACF Repeater field either. How does it work? Can I add as many images as I want in a single post? I must give it a try soon.

Yes. In the field settings you just but one image filed inside the repeater. Now you can add as many images to your CPT as you like.

Thanks!
Just to confirm if I’m doing it correctly.

Yes, this looks good :+1:

Thanks a lot, @Jonas

I’ll try uploading images and setting up my desired grid layout to see.

Hey @Jonas
I’ve uploaded some images to a post for testing purposes. I’m unsure why the images were not showing on the front end. When I check through the dev tool console, the source of the images is not there.

Do you happen to know what am I missing?

Here is query template setup.

Then the image, I chose ACF Data (repeater’s field).

Any ideas?

Yep. You need to use the Repeater Block :wink:

Bildschirmfoto 2023-09-08 um 17.00.11

Inside this Repeater Block you put your Image Block.

Ah…my bad. Thanks!
I encountered another issue. I am unable to add an image to the repeater block. When I add an image block then drag to the repeater but it just won’t stack inside. @Araminta is this a bug?

Do I need to use the repeater block in the query template? Or repeater block alone?

You first need to select a valid source. As long as there is no source and therefore no data you can’t add anything inside the repeater.

But I’ve already chosen my ACF source.

Not sure why it’s not working.

You also need to use the Danymic Preview with a Post where these fields are populated.

1 Like

@Jonas Thank you! It works well now.

Next, I see the grid layout, and I can only design for the first 3 grid columns. As there is no way to add more columns for me to design.

Sorry for asking so many questions!

Yeah that does not work. For this you probably need to use custom CSS.