The initial creation of a custom post type is extremely easy. It only requires a single function to be called from an action hook callback. Once in place, a lot of functionality immediately becomes available to administrators and site visitors. This recipe shows how to create a new custom post type that will be used to store Book Reviews.
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.
- Navigate to the WordPress plugin directory of your development installation.
- Create a new directory called
ch4-book-reviews
. - Navigate to this directory and create a new text file called
ch4-book-reviews.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 4 - Book Reviews
. - Add the following line of code to register a function that will be executed during the initialization...