Post Meta fields in Media Details Popup

Support General Post Meta fields in Media Details Popup

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #3388
    JohannJohann
    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!

    #3395
    Anh TranAnh 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 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.