Skip Navigation

[Resuelto] Image shortcode does not out alt text from media library

This support ticket is created hace 5 años, 11 meses. 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.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

Etiquetado: ,

Este tema contiene 5 respuestas, tiene 2 mensajes.

Última actualización por Waqar hace 5 años, 11 meses.

Asistido por: Waqar.

Autor
Mensajes
#1160876

I am trying to: Display an image field from custom post type using alt text entered in the media library. The image shortcode implies that using alt="%%ALT%%" will put the alt text into the result HTML. This is not the case, nor does it even add alt="". This is an issue for accessibility reasons.

I cannot simply use the post title as the alt text because it is not accurate for the purposes of alt text, nor will the same alt text work for multiple images on the same page. I also cannot add any additional code to the functions.php file.

Link to a page where the issue can be seen: enlace oculto

I expected to see: Image html with an alt attribute

Instead, I got: Image html without alt attribute

#1161623

Hi there,

Thank you for contacting us and I'll be happy to assist.

I've tested the Type's image field shortcode ( ref: https://toolset.com/documentation/customizing-sites-using-php/functions/#image ) on my test website and it generated the "alt" attribute as expected.

Shortcode used:


[types field="employee-image" alt="%%ALT%%" title="%%TITLE%%" size="thumbnail"][/types]

Backend screenshot:
enlace oculto

Frontend screenshot:
enlace oculto

Please check if the shortcode was used with alt attribute and the actual image includes the alt text in its media library field.

In case the issue still persists, please test the shortcode again with only Toolset plugins enabled and a default WordPress theme (like Twenty Seventeen), to rule out any code conflict.

I hope this helps and let me know how it goes.

regards,
Waqar

#1161640
image alt 2.png
image alt 3.png
image alt 1.png

I activated the Twenty Seventeen theme and deactivated other plugins (aside from the multisite must-use plugins). The alt attributes still do not show up: enlace oculto

Here is the template code:

[wpv-post-title]<br><br>
[types field='photo' title='%%TITLE%%' alt='%%ALT%%' size='thumbnail' resize='proportional'][/types]<br><br>
[types field='testing-more-photos' title='%%TITLE%%' alt='%%ALT%%' size='medium' resize='proportional' separator=', '][/types]

I've attached photos of the alt text in the media library.

#1162859

Hi there,

Thank you for waiting and for sharing further details.

While I'm still not able to reproduce this behavior of the missing "alt" attribute, I found a similar report, where the same issue was resulted due to incorrect/incomplete site migration from one URL to another.
( https://toolset.com/forums/topic/alt-tag-not-displaying/#post-594618 )

To confirm if your website has the same issue, please upload a new image that hasn't been uploaded to the media library before and then use it with your image field. If it shows the "alt" tag correctly, you'll need to update your website's database to use the correct "guid" values, for the existing image uploads.

regards,
Waqar

#1167773

Hi, I've been out for a few days, but I'll look into this more and report back. Thanks!

#1168404

Thank you and I'll wait for an update.

regards,
Waqar