Capturing and displaying information using custom meta boxes
The WordPress post and page editors are organized in a series of collapsible sections with headers called meta boxes. While WordPress is mainly responsible for populating these containers with all of the appropriate elements, plugin developers can insert their own sections by registering user meta boxes.
To demonstrate this capability, this recipe shows how to add a custom meta box that will be used to display and capture information about the name and web address of the source materials used when writing a new post or page entry.
Getting ready
You should have access to a WordPress development environment, either on your local computer or a remote server, where you will be able to load your new plugin files.
How to do it...
- Navigate to the WordPress plugin directory of your development installation.
- Create a new directory called
ch5-post-source-link
. - Navigate to the directory and create a text file called
ch5-post-source-link.php
. - Open...