ACF and Loop & Logic problem

Hello there !

I’m using Loop & logic to create links on my gallery thumbnail’s.
Let me explain :slight_smile:

I have a gallery of 15 thumbnails. I want to add to each of them an icon with a link of a picture in a ligthbox.

-I’m using ACF to get the picture and L&L to create the link with the lightbox.

-The acf code of the images is “dio-img”

The L&L code is :
"
Capture d’écran 2022-05-24 à 17.07.32

"

Everything works fine execpt that the first thumbnail doesn’t get any link ! :(. Only the others !

Can someone help me ?

Thx !

Hey Julien, welcome to the forum! I’m not sure how much I’ll be able to help here, but I’ll do my best. As far as I’m aware ACF’s image field only allows you to add a single image, whereas ACF’s gallery field allows you to add several. You mention that you’ve added 15 images and yet you’ve used the acf_image attribute and not the acf_gallery attribute. Is your dio-img field an ACF image field or a gallery field? If it’s an image field as your markup suggests, how have you added 15 images to it?

I’m guessing you might be using img field nest inside a repeater field?
In that case, the syntax would be

<Loop acf_repeater=repeater_field>
  <Field acf_image=img_field field=url /> 
</Loop>

The above example works the same if u put multiple img fields into group field.

If not, maybe you insert multiple no’s of image fields? Then you have to call each field liek so:

<Field acf_image=img_field_1 field=url /> 
<Field acf_image=img_field_2 field=url /> 
<Field acf_image=img_field_3 field=url /> 
<Field acf_image=img_field_4 field=url />

But either ways, creating a single gallery field would make life much easier.

Thanks for your help

I’m using Loop and logic inside an Avada postard layout. Avada create a gallery with my portfolio’s posts. Then i can customize the layout of each thumbnails in one instance. For example if i had some title element in the layout (with dynamic content) each thumbnails will have the title from the right portfolio post.
Unfortunately i can’t use the layout to work correctly with multiples featured images that’s why i’m using ACF and L&L

My code is in a shortcode in this layout so normally each thumbnails should show the result.
But like i said the fist thumbnail is the only who doesn’t show the link and i don’t know why.

I’m sorry I cant help u directly in this Avada gallery plugin.

Relating to wp gallery plugins, I had an opportunity to work with foogallery pro plugin from one of my client’s project. It was using CCS, then now L&L (after migrating the supporting engine). I discover 1 unusual thing when working with gallery displaying with shortcode: When parsing variables into foogallery shortcode from query loop, the gallery only shows up properly when it’s Set in local variable, example:

<Set local=postid><Field id></Set>
[foogallery id="{Get local=postid}"]

Maybe you would wanna look into this area.