Custom Fields
Re-Envisioned
Support General Post Meta fields in Media Details Popup

This topic contains 1 reply, has 2 voices, and was last updated by  Anh Tran 3 years ago.

  • Creator
    Topic
  • #3388

    Johann
    Participant

    Well this is not really a support question but the solution might be useful for others too. I am using the image_advanced field, the single images are linked to the attachment edit popup.

    Now what I try to figure out is how to display the post meta fields in the attachment editor below the WordPress default Caption/description etc. fields – and how to save the meta values.

    A starting point will be the print_media_templates action hook but I can’t figure out how to display it correctly. Must work with Javascript and wp.media.view somehow.

    Maybe you can point me to the right direction? I also don’t find much online documentation.

    Thanks!

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #3395

    Anh Tran
    Keymaster

    Hi Johann,

    Working with Backbone (which is used to make everything with the media library) in WordPress is a pain. There’s no documentation at all in the Codex. There are very few articles about it 🙁

    You can read the source code of Meta Box to understand how to word with wp.media.view. This is another great tutorial to start working with Backbone view.

    However, in the WordPress environment, there’s no official solution to inject fields into the Media Details Popup for now. This is how we use wp.media to open the Media details popup when clicking the edit link. The technique is discovered by funkedgeek on Github.

    I see Jetpack adds some config for Tiled Gallery in the Media popup, which might be a good example how to hack it.

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.