Tell us what you are trying to do?
I want to build a view with an image gallery with a lightbox and I want the title of the image to be the caption in the lightbox.
Is there any documentation that you are following?
I have read dozens of forum issues on this topic but I can't seenm to solve it.
Is there a similar example that we can see?
What is the link to your site?
hidden link
On the page: hidden link for example there is a gallery with 6 images at the end of the article. This is WordPress Blocks. Ik works the way I want this. But I want a caption under each image in the lightbox. I added an repeater field for the post type 'artikelen' for the images in the lightbox. That works. But I cann't add the caption.
The code in the view I used is:
[wpv-for-each field="wpcf-gallery-images"]
<div class="uk-width-1-1 uk-width-medium-1-2 uk-width-large-1-3 gallery-item">
[types field='gallery-images' alt='%%ALT%%' title='%%TITLE%%' width='200' height='200' align='none' resize='crop'][/types]
</div>
[/wpv-for-each]
What I want is the title of the image in the title="%%TITLE%%" of the <a>-tag.
(I used Uikit 2 as a framework: hidden link)
Hi, unfortunately the %%TITLE%% placeholder only works inside the Types field shortcode, not inside the wpv-for-each shortcode. That means the title attribute is probably added correctly to the image tag, but not the parent link tag. I don't think you'll be able to solve this with wpv-for-each, because there is no iteration index available during the loop. You'll need to know the iteration index to be able to query the database and get the correct image title based on the loop index. You'll need custom PHP code that iterates over all instances of the repeating field and assembles the link tags similar to this solution from Shane: https://toolset.com/forums/topic/i-need-to-display-the-repeating-image-title-below-the-image/#post-1241867
I'm not sure of your PHP skill level, so let me know if you need more direct guidance on the changes that will be needed to adjust this example to your site's requirements, and I'll be glad to provide some more advice.