Skip Navigation

[Resolved] Add title & alt text to Image

This support ticket is created 6 years, 8 months 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 6 replies, has 2 voices.

Last updated by andyK-6 6 years, 8 months ago.

Assisted by: Christian Cox.

Author
Posts
#788171

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

#789032

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.

#789186

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']

#789352

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.

#789528

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?

#803501
form-mockup.png

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.

#805675

Thanks, try something else.