I am writing a plugin that depends on modal dialogs for screen space.
Right now I am using jQuery to create the dialogs, but I want a way that integrates better into the admin theme.
Obviously WP has to have some sort of native dialog system (it’s used for uploads). How do I access it?
The WordPress admin area uses Thickbox, which is still a jQuery plugin (jQuery is used all over the admin area). You need to enqueue the script and style (
add_thickbox()
does this for you), and then all links that have classthickbox
will be converted. You need to add some URL parameters too, for example the image upload link looks like this:media-upload.php?post_id=735&type=image&TB_iframe=1&width=640&height=285
.post_id
andtype
are WordPress-specific, butTB_iframe
,width
andheight
are needed for Thickbox, and you should use them in your own links too.