Wednesday, July 28, 2021
No menu items!
HomeBusinessHow to use WordPress Custom Post Types (CPT) to make editing a...

How to use WordPress Custom Post Types (CPT) to make editing a breeze for your clients

What is a custom post type (CPT)?

Think about the parts that make up a standard post on WordPress. Now, imagine that all those components were customizable and could be expanded to fit any type of content. That’s how custom post types work. From its earliest days, WordPress already had a few post types built in, including posts, pages, attachments, and menus, but version 2.9 opened up this structure up to everyone allowing a greater level of customization to the platform.

Are custom post types (CPT) the right move for your project?

Of course, custom post types are not always the best solution for every clients’ request. Often a content addition can be resolved by creating a landing page, using a custom page template, installing a plugin, or sprucing up an existing archive template, but other times you need a more robust solution.

Ask yourself this:

Is the content repeatable? A CPT is overkill for a one-off request and should only be used when a similar type of content needs to be repeated indefinitely.

Can the content be templatized? CPT is best for content which is going to be displaying the same variable dataset.

Do you want a dynamic and dedicated browsing experience for this content? You’ll often hear clients ask for a page where users can browse the latest from only this specific content type, as well as use the words “library,” “reference list,” “calendar,” or “portfolio” in describing their needs.

If you answered yes to any of these, then CPT may be the best tool to keep that content looking tidy.

How to Build Your Own WordPress Custom Post Type Plugin
This is a great opportunity to use CPT because the content is repeatable, can be templatized, and would benefit from a dynamic and dedicated browsing experience.

Before You Do Anything Else, Make a Plan for Your CPT.
There are three things to consider during the planning phase when creating a CPT.

1.What’s the data?
Talk to your client to get an idea about what information they are wanting to display. For this example of the Dungeons & Dragons character library, I want to display the following information from character sheets:

– Character’s Name
– Player’s Name
– Level
– Race
– Class
– Character Sketch
– Backstory
– Alignment
– Background
– Age
– Height
– Weight
– Eye Color
– Hair Color

2.What should it look like?
Wireframe the pages so you know where and how the data will need to be pulled into the front-end. It doesn’t need to be complicated, just a basic page layout for where this information will show up.

3.Which blocks are we using?
In November 2020, WordPress released Block Patterns and Block Templates, which makes CPT page building easier than ever.Many of the features of a standard post, e.g. post title and content, are available by default through the custom post type.

spot_img

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -

Most Popular

Recent Comments

Open chat