Displaying a pop-up dialog using the built-in ThickBox plugin
As annoying as they can be to visitors, pop-up dialogs are a feature that many website administrators use to help them advertise special offers or get readers to subscribe to their content. Since it uses pop-up dialogs in its own administrative pages, WordPress comes bundled with a jQuery script called ThickBox that can be used to display these types of dialogs.
Getting ready
You should have access to a WordPress development environment.
How to do it...
Follow these steps to load the ThickBox script and use it to render a pop-up dialog:
- Navigate to the WordPress
plugins
directory of your development installation. - Create a new directory called
ch9-pop-up-dialog
. - Navigate to the directory and create a text file called
ch9-pop-up-dialog.php
. - Open the new file in a code editor and add an appropriate header at the top of the plugin file, naming the plugin
Chapter 9 - Pop-Up Dialog
. - Add the...