Adding a new section to the custom post type editor
While the custom post editor that has been put in place so far is functional, it is not the friendliest of user interfaces, especially with the custom fields section, where users need to type or select the names of each field as they create new items. A cleaner approach is to create a custom interface using the meta box mechanism that we saw in the previous chapter to display all the data associated with our book reviews.
You should have already followed the Creating a custom post type recipe to have a starting point for this recipe, and the resulting plugin should still be active on your development site. Alternatively, you can get the resulting code (
ch4/ch4-book-reviews/ch4-book-reviews-v1.php) from the book's GitHub page and rename the file
How to do it...
Follow these steps to create a meta box that will be associated with a custom post type and learn how to save the information...