• Is there a way to allow the user to specify a few text fields if only a single image is uploaded?

    I’d like for there to be a way to specify (at least) the Description or Caption that should be used for the image when it is shown in the comment. This would require (I think):

    • An extra text field to provide said caption/description (which would be stored in the caption or description field for the attachment)
    • Rendering of the caption/description on display of the attachment. Ideally for me, this would be done with the WordPress [caption] shortcode, but endering it in any fashion would be just fine, since I can then style it appropriately.

    I’m happy to do this with filters/actions as opposed to a plugin update, but I’m not sure where to get started.

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Denis Yanchevskiy

    (@denisco)

    Hello @turbodb,

    This looks like a complex task, so I think I can only give general recommendations.

    You can try adding fields via the dco_ca_attachment_field filter or one of the filters from the form_element method.

    Saving an attachment processed in the save_attachment method, but there are no hooks in it (maybe I’ll add something in the next version). Therefore, it is probably worth trying to find some hook in the media_handle_upload wp-function or, if that doesn’t work, try connecting to the attachment_id meta update. All these are workarounds and, apparently, not very convenient, but this is what came to my mind. So you can try to connect in this place and add additional information to the attachment from your fields.

    About the output. DCO Comment Attachment saves attachments to the WordPress media library. So you can use any WordPress features to work with attachments. I don’t know if this will help, but here is the shortcode code for outputting attachments in the plugin.

    Thread Starter turbodb

    (@turbodb)

    Thanks @denisco, and sorry for the delay in responding, I’ve been out of town.

    For the Caption/Description/etc. fields – I’m really just hoping to set the existing fields that are shown in the WP Media Library / Attachment UI. Are you saying that adding those to the attachment upload / plugin functionality is the complex part? (I’m not sure if you thought I wanted to add other, custom fields).

    Thanks!

    Plugin Author Denis Yanchevskiy

    (@denisco)

    By complex I meant that the plugin does not have built-in tools to add custom fields. So this task will require custom development. But if you are ready for it, then I think you will succeed ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.