Attach Files Metabox

For the part of opening a lightbox, browse for something and then performing something on an action within: WordPress has this already build in. For what you ask is basically the thickbox that opens up like in the post editor when you browse for an image in the gallery.

You find all the code you need for that already in wordpress. The only thing you need to do is to collect the rather more complex chunk of code, package it up in a plugin on it’s own and modify it to fit your needs. Those components are not very re-useable on their own, so there is no API which could have made this easier for you. Well, that’s not really true, you can use tb_show() to display the thickbox for example.

But overall, this is not trivial. You probably are looking for something that is easier to adopt. I don’t know. I once tinkered with thickbox <-> post editor communication (which might be more complex with what you need), and there is a lot to think about to do things. But for the scenario you describe, it’s often needed, to signal the page that is opening the thickbox to update something after the selection in the popup has been made.

For the metabox, you should find enough code-snippets how to create one, so I’m pretty sure that there is already code for that.

Leave a Comment