fbpx

Intro to WordPress Custom Post Types

by Nate Hoffelder

After a decade of running The Digital Reader, Nate is a veteran web publisher with experience in design, maintenance, recovery, and troubleshooting. What little he doesn't know, he can learn.

December 24, 2017

Custom Post Types (CPT) are one of those new additions to the WordPress platform that I don’t think anyone has ever really explained adequately. (Or at least, I had questions that I struggled to find answers for.)

The following is my intro into working with, and designing, custom post types. (Hereafter I will refer to them as CPT).

Background

The first thing you should know about CPT is that the name is misleading. It should be custom _data_ types, because CPT is a way of displaying data. The data might look like a blog post, or it might look like a product listing, or it might look like a page in a tech manual, but no matter what it looks like it is a CPT.

This may sound like just a fancy name for a page on a site, but that misses the point, which is that CPT lets you automate a lot of work..

Let’s say you have a CPT called testimonials, and you want to publish a couple hundred. The value of a CPT is that you only have to define the layout for the testimonials CPT once and then the site will automatically display all of the testimonials the exact same way. And if you want to change the layout, you only have to change it once, and all the testimonials will have the new layout.

Do you see this book page on my publisher demo site? This was generated automatically. All I had to do was enter the title, summary, and other data and hit publish. (I also had to upload the book cover.)

That is nifty, but it gets better.

Not only can you use a CPT to display data, you can also make custom archive pages just for the CPT on your site. You can make that archive page look the same as your blog posts, or you can make that archive page look however you want.

Do you see this page on my publisher demo site? That is an archive page which came with the Novelist plugin. It automatically shows book covers for each of the books I listed on the  site. I didn’t have to do anything on that page other than decide on the name.

Getting Started

Now that you understand CPTs as a concept, I’m sure you want to take one apart and put it back together. (That’s how I learn new stuff, anyway.)

What you should do is set up a new WP site as a project, install and activate Jetpack (including its CPTs, testimonials and portfolio), and then install one of the themes listed near the bottom of this page. Those themes have custom templates for the CPTs in Jetpack, and since they are free to download you can pull one apart and see how the code is put together.

That last part is important to me because I kept having questions that no one had answered online, and I could only answer them by taking a theme apart.

Designing

I have not had to make a CPT, just modify existing ones, but I can tell you that if you want to make your own CPT there are an abundance of tools if you know where to look.

The first step will be to install the Custom Post Type UI plugin on a WP site, and then use that plugin to make a new CPT for that site. This plugin will make a CPT that is essentially identical to a blog post. That is not terribly original, but it is a good place to start designing the layout, themes, and features for your own CPT.

The rest is up to you.

Any questions?

image by Bohma via Flickr

Hi, I'm Nate.

I build and fix websites for authors, and I am also a tech VA. I can build you a website that looks great and turns visitors into fans, and I can also fix your tech when it breaks. Let me fight with tech support so you don’t have to.

My blog has everything you need to know about websites and online services. Don’t see what you need. or want personalized help? Reach out.

You May Also Like…

7  Website SEO Tips for Authors

7 Website SEO Tips for Authors

Search Engine Optimization, or SEO, is a vast and complicated topic with ever changing best practices. Google changes...

How to Find an Indie Bookstore

How to Find an Indie Bookstore

Back when I was a blogger, I used to have a beef with the American Bookseller Association. You see, the ABA had a...

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Skip to content