Skip Navigation

[Resolved] wp-for-each for image gallery returning all URL not each

This support ticket is created 3 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+01:00)

This topic contains 5 replies, has 2 voices.

Last updated by stephaneL-3 3 years, 11 months ago.

Assisted by: Nigel.

Author
Posts
#1621445

I am trying to:
Setup an image gallery, the image gallery works but the link on each image jumps from the single URL to all the URL of the image gallery items at once, preventing the lightbox to work properly returning nothing but error missing image.

Link to a page where the issue can be seen:

I expected to see:
the image clicked to be displayed in light box

Instead, I got:
Broken Image...

You can see a vdo of the problem here: hidden link

On a last note, I was using an elementor Image Gallery widget before, however and like on another site the widget with toolset is really buggy, it will show duplicates versions and images from the post but not in the gallery like the logo and other image file relating to other fields .. the only way to avoid this was to use the shortcode but then this happens 🙁

Thankyuou for your time
Stephane

#1622271

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi Stephane

I can't see the video, it's private.

Can you share the section from the editor (the markup and wpv-for-each shortcodes) used to create the image gallery?

(You can use code tags to format the code here in your reply.)

#1622275

Hi Nigel,

Thankyou for your response,
Sorry for hte vdo here it is and should be ok, I am getting you a screenshot of the code shortly too:

hidden link

s

#1622279
[wpv-if field="wpcf-galerie-photos" evaluate="!empty($field)"]
<div id="my-gallery">
[wpv-for-each field="wpcf-galerie-photos"]
  <div class="galPix"><a href="[types field='galerie-photos' url='true'][/types]">[types field="galerie-photos" width="150" height="150" proportional="false" align="center"][/types]</a></div>
[/wpv-for-each]
</div>
[/wpv-if]
#1622665

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Before I test this locally, another option would be to use the Toolset Gallery Block to create your gallery and then you wouldn't have to enqueue a 3rd-party gallery library.

Create a Content Template (not assigned to any post type) and set up the gallery using the block editor within that template.

Then insert the shortcode to output that template into your Elementor design in a shortcode module.

I checked that locally and it worked, would that be an option for you?

There is a quirk in the details of how you do this if you want to try.

To set up the gallery in the content template, you must choose to preview a post that has images for you to be able to create the gallery and choose the image settings. But you can only preview posts or pages in an unassigned template. So you first need to create the template and say assign it to the post type in question, set up the gallery block, then change the document settings to unassign the template from any post type.

Try inserting the template using the Fields and Views button in a normal page so that you can then copy the generated shortcode and paste it into your Elementor module.

#1622839

Hey Nigel,

Ok, not that straight forward and still puzzled as to why the gallery with repeating image just won't work "easily" via elementor or using wp-for-each method; but now it is working using LAyout > add views/layout /using shortcode in elementor;
Many hoops jumped but I guess it works 🙂

thank you
s

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.