WordPress needs to know how to display your new post type. You have to create a template for a single book, and one for the listing of books. Perform the following steps to do this:
- First, we'll make a book version of single.php. It must be named single-POST_TYPE_NAME.php, which in our case is single-book.php.
- Using page.php as our starting point (as it's already the closest to what we'd like our book page to look like), we're going to add the display of the custom field, book_author, and the featured image.
- So, let's start by taking our page.php file, making a copy of it, and renaming it single-book.php. Also, let's make a copy of content-page.php and call it content-book.php.
- Next, it's time to include all ...