As annoying as they can be to visitors, pop-up dialogs are a feature that many website administrators are using 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.
This recipe shows how to load the ThickBox script and use it to render a pop-up dialog.
- Navigate to the WordPress plugin 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 following line of code to register a function...