Tell us what you are trying to do?
I have a gallery with 10 images and i need title and alt text for this images.
Is there any documentation that you are following?
no
Is there a similar example that we can see?
no
What is the link to your site?
hidden link
Hi, if the images in the gallery are custom field images created by Types, you can use the types field shortcode to display an image and include the alt and title text from the Media Library:
[types field="my-image" alt="%%ALT%%" title="%%TITLE%%" size="thumbnail"][/types]
Or you can supply any text you would like, including other shortcodes:
[types field="my-image" alt="%%ALT%%" title="[wpv-post-title id='$current_page']" size="thumbnail"][/types]
More information about the Types field shortcode is available here:
https://toolset.com/documentation/customizing-sites-using-php/functions/#image
Let me know if you have other questions about this.
No no!
It is for a CRED Form.
Customers upload the images an write a title to each image.
[cred_field field='bild-galerie' post='mietobjekt' value='' urlparam='' output='bootstrap']
Oh okay I understand. There's not an easy way to do this in CRED because there are no title or alt text fields for each image. One way I can think of is to create a custom post type called "Slide" or something similar that has a featured image and two custom fields - one for the title text and another for the alt text. Then create a separate CRED form for managing these Slide posts. When you display the featured image, include the custom field values for the title and alt text.
Another way you could do this requires generic fields. Add generic text fields to the form for each image's alt and title text. Then use the CRED API cred_save_data to capture information from the form and save it to the image in the Media Library.
Ok, i prefer the second option, but with repeating fields.
I think it's like this:
https://toolset.com/forums/topic/cred-repeating-image-fields-gallery-woo-and-non-woo/
Then change the form id and this ['wpcf-product-gallery-image-cred'] and what else?
In the second option, you must to create 3 repeating fields:
- Image
- Title
- Alt
In the CRED form, these fields cannot be connected visually. The User will add images, titles, and alts separately. See form-mockup.png attached - is this acceptable? Since the fields are not connected and the User has full control, he or she could add the wrong number of images, titles, and alts, resulting in mismatched elements. If 3 images, 2 titles, and 4 alts are added, how do the fields match up? It seems that you must add custom code that checks the number of each repeating field in the form and makes sure they are identical. If not, show an error.
Thanks, try something else.