Writers Building Websites

Writers Building Websites

Register the Books Custom Post Type

In this lesson, we create a Books Custom Post Type using ACF for author websites, detailing steps from registration to configuration, ensuring easy book content management.

Last Updated: 10 December 2024

Introduction

There are 4 stages to build a Books Custom Post Type for an author website.

  1. Number 1. Create the Books Custom Post Type in ACF Pro
  2. Number 2. Add supporting taxonomies
  3. Number 3. Create custom fields for our book specific content inside ACF Pro
  4. Number 4. Build a Books Post template in WordPress and associate it with the Books custom Post type.

In this lesson we will start the process by creating our Books Custom post type in ACF Pro

Register Books Custom Post Type

First we will register our Books Custom Post Type.

  • From the WordPress admin dashboard go to ACF then Post Types.
  • Click on the +Post Type Button
  • First we are going to name our new post types
  • Enter Books in the plural label
  • UNderneath in the singular label write Book
  • ACF will automatically populate the ‘Post Type Key’ field with an all lowercase ‘book’
  • I’m going to update that to books

Taxonomies

Next, ACF wants to know what taxonomies we want to use. Taxonomies in WordPress is a way of grouping and organising content types. When I click inside that field I have the choice of using WordPress’s native Categories, Tags, or Format taxonomies to organise this new Books content type. In a later lesson we are going to add taxonomies specific to books so I’ll leave this blank.

Advanced Configuration

We definitely want this Books Custom Post TYpe to be publicly visible so I’ll leave it at the default of PUBLIC

This post type is NOT hierarchical. There are no child post types to this one so I’ll leave that option deactivated.

I do want to use advanced configuration so I’ll activate that now.

General Settings

Under GENERAL SETTINGS we define which features of the content edit screen we will use for this post type. A regular content edit screen for a WordPress post looks like this. (SHOW REGULAR POST SCREEN). We want the Books Content edit screen to look like this (Show the completed BOOK POST TYPE). 

Having the Content Edit Screen structured like this makes it a lot easier to add new books because we are filling out a form with information we already have. We get this structure by what we configure in our settings here, and in the next two lessons where we add custom categories and custom fields.

Here in the GENERAL SETTINGS section of setting up our Books Custom Post type we set what content editing features we want to use on these posts. It’s worth having a rundown what each of these features are and why I choose to use them or not.

  • Title is the title of the post. For our Books post this will be the book title so we definitely want that.
  • The editor is this big content area we’d normally use for adding blog posts but that’s too free form for what we are doing here. Our Book posts will get all their content from the custom fields we’ll create in a later lesson. Untick.
  • We are going to use the Featured Image for our Book Covers so I’ll tick that.
  • Excerpt is a summary of the post that we will use for post listings and archive displays around the site so we will tick that one as well.
  • Author displays the name of the author of the post, not the book. This is normally used in metadata but we don’t need it for our book posts.
  • Trackbacks are a way for other websites to let you know they have linked to this post. The problem is most trackbacks will be from spam sites. If you tick this box you will spend a lot of time approving, deleting, or marking trackback comments as spam. Please don’t tick this box.
  • Custom Fields. WordPress has a built-in custom fields feature which is great! However, these are basic, difficult to use and do not have all the features we need. That’s why we will use custom fields from ACF so I will leave this option unticked.
  • I’m not using comments on this website so I don’t need that feature on this custom post type.
  • Revisions are great for keeping multiple versions of a post but I don’t recommend editing content inside WordPress. That’s much better done in a dedicated text editor and I’ll show my workflow for that in a later lesson. I’ll leave Revisions unticked.
  • Page attributes are used to set parent pages and change the order of your pages. We will not be doing either of those so this option is unticked.
  • A post format is a piece of meta information that can be used by a theme to customise its presentation of a post. We are going to use ACPT to manage everything about the Books custom post type so this feature is not used and unticked.

I give this new custom post type a description. We are going to use this description at least one template one the website in a later lesson. “The complete portfolio of all Dirk Volcano books. If you’re looking for thrills or mystery you’ll find your perfect read below.” and activate it.

That’s all the GENERAL SETTINGS completed so we’ll go to the next tab

Labels

The only change I’m going to make in the labels section is to scroll down to the bottom and add a placeholder to the title field.

“The book title as it appears on the cover”

This is a reminder to avoid keyword stuffing in the title. We cover the best way to optimise books on your website in the Author Website Playbook

Visibility

  • Change the MENU POSITION to 4 so the BOOKS menu item appears right under POSTS in the side navigation bar in the admin dashboard
  • UNder MENU ICON I’ll search for book and assign the first book icon returned in the results

When I click save the dashboard will take a few seconds to refresh and when it does you’ll see the new BOOKS icon underneath POSTS in the admin sidebar

URLS

We want there to be an archive page for the books post type, an area of the website that displays all books posted by the author.

  • Activate ARCHIVE
  • Leave the ARCHIVE SLUG field blank as we will use the default ‘Books’

We have no other changes to make to this custom post type so I’ll click save.

If I wait a few seconds the WordPress dashboard will refresh again. When I hover over the Books ICON in the menu we get the options to see All Books or Add New Book. When I click on Add New Book we get a severely cut down content edit screen. That’s ok. That’s exactly where we should be until we build our Books custom post type with all its superpowers.

Add our first Book

Normally I’d wait until I fully registered a new custom post type with all its custom fields but for these lessons I’ll add book data as build out the full custom post type.

For this example I’ll add ‘Adventure Danger’ the first book in the Dylan Danger series from Dirk Volcano.

  • Book title is Adventure Danger
  • Excerpt is
    • In Adventure Danger, the first in a thrilling new series, ex-special forces Dylan Danger must risk everything to save his family from a ruthless crime boss.
  • And I’m going to upload the Book cover as the featured image.
  • Save as draft

OK, I’ll click on preview and see how that looks.

It’s completely blank.

We aren’t seeing anything yet because we haven’t created a template inside Breakdance to display our new custom post type. We will do that in the upcoming course module ‘Build a Books Custom Post Template.

In this module we’ll continue to build our Books Custom Post type and populate the fields with details from Adventure Danger.  Then, when we move into building our templates we’ll see book posts take shape with all our books information.

Summary

In this lesson we have created our Books custom post type and registered it with WordPress. Although the content edit screen is a little sparse right now we’ve taken a huge step. We have now defined a dedicated post type for our books which, as you’ll see by the end of this module, gives us total control over how our book posts will look without affecting the rest of the site.

Call to Action

I hope you’re enjoying the course so far? If you have any questions, comments or feedback I’d love to hear them. Click on the Contact link below and let me know via your preferred channel.

Stephen Gordon
Stephen is the founder of Writers Building Websites and brings over a decade of experience as a freelance marketer specialising in publishing. He is also an author.

Index

Copyright © 2024 Writers Building Websites | All Rights Reserved.