Skip Navigation

[Gelöst] Caption for for Front End delivered images

Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.

Problem:
The user would like to allow visitors to submit content and be able to add alt text and captions to images.

Solution:
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

This support ticket is created vor 2 Jahre, 10 Monate. There's a good chance that you are reading advice that it now obsolete.

Dies ist das technische Support-Forum für Toolset – eine Suite von Plugins zur Entwicklung von WordPress-Websites ohne PHP-Pogrammierung.

Jeder kann in diesem Forum lesen, aber nur Toolset-Kunden können darin Beiträge veröffentlichen. Der Toolset-Support arbeitet 6 Tage pro Woche, 19 Stunden pro Tag.

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: Africa/Casablanca (GMT+01:00)

This topic contains 2 Antworten, has 2 Stimmen.

Last updated by romanF vor 2 Jahre, 10 Monate.

Assigned support staff: Jamal.

Author
Artikel
#1711021

Dear support,

is there a way to let frontend users add a caption to the images they upload?
Our users would want to add copyright information to the images they upload via front end form. Is that possible?

#1711115

Jamal
Supporter

Languages: Englisch (English ) Französisch (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello Roman and thank you for contacting the Toolset support.

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

#1712391

My issue is resolved now. Thank you!

Das Forum „Toolset Professioneller Support“ ist für neue Themen und Antworten geschlossen.