Does the WordPress API have a Modal Dialog like BootStrap does?
In my WordPress Plugin admin page – the plugin settings page accessed through the Dashboard – I would like to have modal dialogs appear and allow the user to edit settings.
WordPress has the classes button
, wp-list-table
, tablenav
, etc. I was thinking that there might also be a modal dialog class with some associated Javascript API functions to make it appear and disappear?
1 Answer
Yes, WordPress has modal dialog and it is called as Thickbox, but I am not sure how flexible it is to implement what you want to. Here is the code –
<?php add_thickbox(); ?>
<div id="my-content-id" style="display:none;">
<p>
This is my hidden content! It will appear in ThickBox when the link is clicked.
</p>
</div>
<a href="#TB_inline?width=600&height=550&inlineId=my-content-id" class="thickbox">View my inline content!</a>
Refer for more details – https://codex.wordpress.org/Javascript_Reference/ThickBox