Skip Navigation

[Resolved] Image Captions and Descriptions – how do I get them in a cred form?

This support ticket is created 7 years, 3 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 3 replies, has 2 voices.

Last updated by Beda 7 years, 3 months ago.

Assisted by: Beda.

Author
Posts
#477532

I am trying to build a membership site, with CRED forms. The users can upload images in the form, but how can I get meaningfull image Alt and Title tags? SEO will be very important for the site, so it is quite an issue.

#477875

When you "Allow Media Insert button in Post Content Rich Text Editor" when you create your Post Form, there will be a native WordPress Image upload screen where you can set those details just as used to in WordPress.

If you use a Types Image Custom Field, the uploader does not present those features and they would either need to be updated to the Attachment via a Custom PHP Script, using values coming from as example some "Single Line" Custom Types Fields, or, you would use the autogenerated values.

Both ways to upload images create a Post of type "attachment".

The different Meta-Data is stored as this:
Alt Text: uses the Post Meta Key _wp_attachment_image_alt
Caption: it's the actual Post Excerpt (Table column name post_excerpt)
Description: it's the actual Post Body (Table column name post_content)

With this, you could create some Single Line Fields where the users enter Alt, Description and Caption, then you grab this info with the get_post_meta function and update_post_meta or wp_update_post them to the Database via a CRED Save Data Function.
https://developer.wordpress.org/reference/functions/get_post_meta/
https://codex.wordpress.org/Function_Reference/update_post_meta
https://codex.wordpress.org/Function_Reference/wp_update_post

The CRED API will help you to fire those above functions when submitting the Post with CRED:
https://toolset.com/documentation/user-guides/cred-api/#csd

#479126

Hi Beda,
Thank you for your reply. I must say I am disappointed. One would expect something like this to be an essential part of the Cred forms. In these times when images are important and people search more and more with images it is not wise to publish images without alt and title tags.
The Allow Media is not an option, because I don’t want my frontend editors to see all media. So I will have to go to your second option, but that will cost me some time to puzzle. I will manage, but I dislike it. What is the function of Toolset if you still have to dive into PHP. I leave the issue open, because I don’t have the time yet to follow your suggestions and to test it.
Wouldn’t it be an idea to make a feature request of this issue for your developers? It would make CRED better.
Marijke

#479566

Well, the thing is, even when you upload an Image via the WordPress Uploader, you still will have to edit those values, it's not automatically generated.

Once we will include the native Image Upload mechanism in CRED Fields (this is a project we are on), this can become possible.

But quoting your own statement, I think you will see why it takes a while to implement this:
"The Allow Media is not an option because I don’t want my frontend editors to see all media".

Exactly. So if we just implement native WP features, this would be the case. And obviously, we need to implement ways of making this either not possible or at least, as a setting to choose by the Admin.

It needs a careful planning and coding, along with considering all aspects of a Membership site.

For now, the only possibility is to use the CRED hooks I presented along with the functions of WordPress elaborated, with which you update those Details.

I understand your point of view, and I can say that we are working on better implementation of this, which means, the feature request you suggest exists already 🙂

I added your voice there as well.

Please let me know if I can be of further help.

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