Skip Navigation

[Résolu] I'm trying to set up a alt and title tag on my image field

This support ticket is created Il y a 7 années et 7 mois. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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/Hong_Kong (GMT+08:00)

This topic contains 5 réponses, has 2 voix.

Last updated by lauraS-3 Il y a 7 années et 7 mois.

Assisted by: Luo Yang.

Auteur
Publications
#435076

I want alt and title to picked up from the media library not manually entered in PHP files.

<?php echo types_render_field('image' , array('alt'=> ' ' , 'title' => ' ' , 'class' => 'attachment-large center-block img-responsive wp-post-image')); ?>

Thanks

#435181

Dear laura,

Please try this:

<?php echo types_render_field('image' , array('alt'=> ' %%ALT%%' , 'title' => '%%TITLE%% ' , 'class' => 'attachment-large center-block img-responsive wp-post-image')); ?

More help:
https://toolset.com/documentation/customizing-sites-using-php/functions/#image
For the alt and title attributes, you can also use placeholders to output the values of standard image fields added in WordPress: %%TITLE%%, %%ALT%%, %%CAPTION %%, and %%DESCRIPTION%%.

#435281

Hi That didn't make any difference ....

#435491

I tested it in my localhost, it works fine, please check these in your website:
1) in above codes, replace the field slug "image" with the your custom field slug
2) deactivate other plugins and switch to wordpress default theme, and test again

#435693

actually It worked.

#435696

Thanks for help.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.