Repeating Image Field – Thumbnail Gallery?
-
If I have a repeating image field where the user can upload multiple images, is it possible to create a gallery on the front end? I want the user to be able to upload multiple images and on the front end, it would show a bunch of thumbnails. Then obviously if they clicked on the thumbnail, it would have a lightbox effect.
The way I’m doing it now is a bit of a workaround. I created a WYSIWYG field where the user can use the “Add Media” button to create a gallery. The downside to this is, they could add text in there if they wanted… which I don’t want them to be able to do.
Anyway, the repeating image field seems like it would make the most sense. Is there a way to take the below code, and have the thumbnail gallery I was talking about?
echo(types_render_field( "my_photo", array( "width" => "85", "height" => "35" ) ));
The only way I figured out how to do a clickable thumbnail was with a non-repeating image and not a gallery:
<a href="<?php echo(types_render_field( "photo1", array( "url" => "true" ) )); ?>"><?php echo(types_render_field( "photo1", array( "alt" => "Photo 1", "width" => "85", "height" => "35" ) )); ?></a>
It would be really tedious to create say, 18 or so of these fields. Surely someone has done this before?
- The topic ‘Repeating Image Field – Thumbnail Gallery?’ is closed to new replies.