I have a repeating image field that I have inserted into a carousel slider in a View. I am calling the image via an intermediate post type.
Everything works fine except the ability to extract the ALT tag from the image which I need to use for the image caption, set by: data-caption="ALT Tag value should go here".
I tried inserting %%ALT%% but this only works if the image is not output as a raw URL.
Here's the View code:
<div class="screenshot-carousel">
[wpv-for-each field="wpcf-screenshot-carousel-image" item="@content-panel-page.parent"]<div class="screenshot-image"><img alt="ALT Tag value should go here" src="[types field='screenshot-carousel-image' size='thumbnail' url='true' item="@content-panel-page.parent"][/types]" data-caption="ALT Tag value should go here"/></div><!-- screenshot-image -->[/wpv-for-each]
</div><!-- screenshot-carousel -->
I have trawled through the support tickets that touch on this issue, but cannot find a solution.
Hello. Thank you for contacting the Toolset support.
The alt tag will work when you try to output the image and that is how it works.
To display the alt text for your image, you will have to add custom shortcode. Here is the related ticket where shorcode with example is mentioned and you should try to follow that. You should make changes to shortcode as required. Please get in touch with me if you will require further assistance.
- https://toolset.com/forums/topic/alt-text-output-for-images-from-custom-field/#post-1857657
The solution you've linked to works perfectly for single images. However, I am outputting a repeatable image field - so this solution doesn't quite work - it outputs the alt tag of one of the images and applies the same ALT to all images.
Is there a way to adapt this solution to work with repeating images? It's a shame that this request didn't become a built-in feature.
Can you please share problem URL where you want to display the alt text and admin access details.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.