Modal/Popup window in WordPress admin

If you need to create modal/popup window in WordPress admin, its easy. You can use buit-in thickbox jquery library.

It’s very well documented @, though lets see quick integration sample code below.

Load thickbox js and css by calling function <?php add_thickbox(); ?>

Add a link to html with class name ‘thickbox’ example below –

<a href="#TB_inline?&width=300&height=300&inlineId=my-content-id" class="thickbox">Open Popup</a>

Then add popup html,

<div id="my-content-id" style="display:none;">
          This is hidden content! It will appear in Popup when the link is clicked.

Now when you click on a link to open popup, above html will display in popup with overlay at back, you can customise as per requirement, check codex for details.

Leave a comment

Your email address will not be published. Required fields are marked *