Skip Navigation

[Resolved] Creating lightbox links for images from a repeating field upload

This thread is resolved. Here is a description of the problem and solution.

Problem:
How to display image repeating field.

Solution:
Using [wpv-for-each] shortcode you can display repeating field created using Types.

For example:

[wpv-for-each field="wpcf-additional-photos"]
<a href="[types field="additional-photos" output="raw"][/types]">[types field="additional-photos" size="thumbnail" align="none" rel="lightbox" resize="proportional"][/types]</a>
[/wpv-for-each]

Relevant Documentation:
https://toolset.com/documentation/views-shortcodes/#wpv-for-each

This support ticket is created 8 years, 1 month 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by daveG-7 8 years, 1 month ago.

Assisted by: Minesh.

Author
Posts
#378723

I'm am making a content template that displays photos from a repeating, multiple-instances-allowed image upload field. I'm trying to create a lightbox that opens when you click it, but am having the problem that all the urls of the images are being added. I tried using <wpv-for-each> as was suggested in some other support threads on similar topics, using the following code:

<wpv-for-each field="additional-photos">
<a href="[types field="additional-photos" separator=", " output="raw"][/types]">[types field="additional-photos" size="thumbnail" align="none" rel="lightbox" resize="proportional" separator=", "][/types]</a>
</wpv-for-each>

However, that doesn't solve the problem. Any thoughts?

#378817

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

As I can see - you are using wrong syntax for [wpv-for-each] shortcode.

You should use, for example:

[wpv-for-each field="wpcf-additional-photos"]
<a href="[types field="additional-photos" output="raw"][/types]">[types field="additional-photos" size="thumbnail" align="none" rel="lightbox" resize="proportional"][/types]</a>
[/wpv-for-each]

More reference:
https://toolset.com/documentation/views-shortcodes/#wpv-for-each

#378878

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I hope above solution will work for you.

#378975

Perfect - thanks so much!

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