Multiple dynamic ACF(free) images in Bricks carousel

I’ve seen a few posts that have not been answered that have similar questions…so creating a new topic in hopes of getting an answer.

Trying to do this in an ACF CPT ‘Case study’ single post bricks template.
Im using ACF free version, and have a Field Group with 5 images for the client to add (each individually, rather than using the ACF Pro Gallery option.) The images are set to ‘aray’ and have no specific sizes.

On the template, i’m trying to add the multiple images within the dynamic content field in the carousel widget…to no avail. I can get 1 image to display (and it repeats 5 times, assuming because i have the slider set to show 5 images), but if i add a second {dynamic image code}, it no longer displays.
Ive tried adding commas, semi-colons, between the {},{}. But that didn’t work either.

My assumption was since i can place individual images manually, that i could simply comma separate the images codes.

Is the ACF Gallery functionality the only way to make this work?
Should i be using Nested Slider instead?
Do i need to add some js or array function to make it work?

Thanks in advance for any help!



Would you simply use image gallery if it was a free field rather than in acf pro? If yes check here: Support ACF Photo Gallery - #11 by Matiasko

If you want to use separate image fields I guess you would have to build an array of img IDs because that’s what most fields of this type expect. Easiest would be to create a custom function and use it as {echo:my_custom_function(post_id) }

2 Likes

Wow, never got a response this quick! (not that ive posted much)
Thank you Matiasko!!

I’ll check out ACF Photo Gallery, and use the provided function…hopefully i can get it to work!
fingers crossed…i do ‘color for a living’, so could be out of my wheel house.

Thank you again!

Matiasko,
tried this method but doesn’t work.

Loaded ACF Photo Gallery, implemented gallery…shows up on CPT ‘Case Study’ edit screen fine. Added images. but the Template execution doesn’t seem to be working.

Ive used the ‘Output PHP Function’ of the Carousel widget and the appropriate call to {echo:get_case_study_gallery}, but the only output is an empty div.

I don’t have to write any other functions as outlined in the ACF Photo Gallery example, do I?
I’m assuming everything should be handled by the Carousel.php file.

Maybe i implemented your code example above in the wrong place? (im using a WP Code php snippet, loading in the header tag…but conditionally…only on my case study pages.

If you could offer any insights that would be great!
Thank you

I’m afk for the whole day. One thing I have spotted is that you didn’t explicitly set Type to “Media” and another that in the linked post it gave an option to select image size below “Images” which it doesn’t for you. So maybe something has changed. I use an ACPT plugin for this now (has LTD if you’re interested), but will check this and update the script if needed.

Truly appreciate your help!
I figured MEDIA grayed out…meant default.
I did notice that too…on your screen cap., regarding the image size field…It’s under IMAGE TAB. I think that’s just my Bricks/settings/builder, ‘DYNAMIC DATA’ setting.

Thank you again for taking the time…cheers!

Just tested and it works in my setup. I’ve created a portfolio CPT using ACF, added a “gallery” field of Photo Gallery typ. Created some dummy CPTs and inserted images in the field. Created a code snippet (I use WPCodeBox) and copy+pasted it directly from my post. Created a query loop and set it to get this CPT. In the carousel I’ve specified the function exactly as mentioned in my post.

Could you describe your setup step by step? I mean the CPT setup (which plugin is used for it, what settings etc.), the ACF field group setup (especially the Photo Gallery Field), a single CPT with it’s fields filled and also all settings of your WPCode snippet. Also show your structure panel with the portfolio item card expanded. This way you can get to the problem yourself and if not, I will have an easier job spotting it.

Ideas on what to troubleshoot:

  1. Check if the name of the photo gallery field is exactly the same as you’ve specified it in the code snippet. This is my personal horror and a reason why I ALWAYS copy and paste instead of typing even the simpliest words like “headline”.
  2. Check what is the hook for your snippet. I guess it should be at least plugins_loaded.
  3. Check where your query loop is set (some people set it on container while it should be on the item that we want to duplicate).
  4. Check if your function works properly by placing the “code” element inside of query loop there you can check the outputs with
<?php
     $test_output = get_case_study_gallery(); 
     echo var_dump($test_output);
?>

So sorry for the late reply…client changed direction…but i will still need to figure this out for another client…And, forgive me in advanced…i’m no developer…here’s my response and a bunch of pictures that i hope may shed some light on what the heck i’m doing wrong.
FYI, im using free plugin you recommended, not ACF PRO.

  1. See screen shot: If, your suppose to use the field ID, then yes. I also changed it to the actual field name…then nothing showed up at all.
  2. I have no idea where to check this.
  3. Query loop is set to Gallery widget…(previously set to carousel widget)
  4. i put your provided code into the bottom of my function snippet. (using WP Code)…to no avail…but i have a feeling you don’t mean in the snippet itself? which is also a query loop, right? Not meaning the Bricks query loop.





Oh it’s a single post page not an in-query use. Sorry, I’ve missed that part in your original post. I’ll check this case when I can and let you know if I was able to implement this.

Yes, it’s a Case Study (CPT) Template.
If push comes to shove, ill use a static pre-defined grid of 5 images…but that’s not ideal.
would be nice to not force any number of images.
Thank you again!!

I’ve got it working on my end so I guess it’s something with your setup but I’m not sure based on these images alone. Do you mind sending me a message here in the forum with temporary admin login so I can help you quicker?

Just a follow up for anyone who is having the same or similar issue…
The culprit seemed to be the default NGINX caching that is enabled on the server side (siteground hosting). I thought id turned all the caching off.

Here’s what [Matiasko] figured out after trying multiple things…Again, Thank you so much!!

" I’ve got it to work.
After initial inspection I thought that this is caused by the " whatwedo ACF Cleaner" plugin or by your WPCode snippet settings.
First the acf_photo_gallery() function didn’t work even when called from pure in-builder code block and when I disabled this plugin, I’ve got it to work. But now it works even with the plugin enabled. So maybe it had to “refresh” etc. but I’m not sure as I don’t use this one.

About the WPCode settings. I’ve tried different combinations of setting for location and logic. It sometimes works everywhere, sometimes only on front-end, sometimes only in builder preview, other times in both builder editior and preview but not on the front-end. What’s worse I don’t think it is consistent (same setting after a while gave different results).

Tomorrow I can check if this is purely because of the snippets plugin by installing my WPCodeBox. But in the meantime, if you have time, please check if you have server-side caching enabled because this behavior would suggest that the server is messing everything up."

Hope this helps…again, thanks to Matiasko!