WordPress

WordPress Custom Post Type Guide: What They Are, Plus How to Create One

May 1, 2019

If you’ve ever set foot inside the WordPress dashboard, you know that WordPress lets you create two types of content – Posts and Pages.

But those defaults are not the only types of content you can create, and a WordPress custom post type lets you create your own content types that you can add and manage through the WordPress dashboard.

You could add “Events”, “Jobs”, “Products” (that’s what WooCommerce does) – anything that makes sense for your site!

In this post, you’ll learn all about what custom post types are and the awesome possibilities they unlock. Then, I’ll show you how you can actually go about creating your very own WordPress custom post type!

Let’s dig in…

What is a WordPress custom post type? Explained in more detail

Custom post types are what make WordPress a full content management system, rather than just a blogging platform.

Using the power of custom post types, you can turn WordPress into an eCommerce store, a local business directory, an event listing site…and anything else you can dream up.

Let’s go a little deeper…

A “post type” is just a type of content at your site. Think of it as a bucket that organizes all the content that’s assigned to it.

Then, each individual entry in that content type is a “post” (lowercase “p”).

That means, and I apologize in advance for the confusion that I’m about to introduce into your brain, Posts are part of the [posts] [post type].

More specifically, one [Post] (uppercase “p” – a blog post) is a single [post] (lowercase “p”) in the [post] [post type].

Similarly, one [Page] is a single [post] in the [page] [post type].

And I’m with you – it seems super needlessly complicated.

However, once you get over that little quirk, it’s helpful to understand that blog Posts are just another post type, and you have the ability to add your own post types via this magical thing called custom post types.

In terms of your WordPress site’s database, each post (lowercase “p”) is stored in the same table in your database, regardless of its post type.

Two Examples of WordPress Custom Post Types in Action

To drive home the idea of a WordPress custom post type, let’s dig into two common examples:

  • WooCommerce, which turns WordPress into an eCommerce store
  • bbPress, which turns WordPress into a forum

With WooCommerce, you can add new Products from your WordPress dashboard. That’s a custom post type! But you also get other post types, too. For example:

  • Shop coupons get their own separate Coupons post type
  • Customer orders get their own separate Orders post type

Or, if you create a forum on WordPress with the bbPress plugin, you’ll have separate custom post types for:

  • Forums
  • Topics
  • Replies

Get the idea? WordPress post types let you do some really cool things with your site.

How to Create Your Own WordPress Custom Post Type

Now let’s take things a little more hands-on and I’ll show you how to create your very own WordPress custom post type.

Don’t worry – while I might’ve scared you a bit with the difference between a “Post” and a “post”, the actual process of creating a custom post type is something that anyone can do – all you need is a free plugin called Custom Post Type UI.

Let’s say you want to create your own custom post type for “Jobs”, like the example I mentioned above.

Once you install and activate the plugin, you go to CPT UI → Add/Edit Post Types. Then, you enter some basic information at the top and click Add Post Type:

wordpress custom post type 1

And that’s it! Once you click the button, you’ll see a new Jobs area in your WordPress dashboard sidebar. To add a new post (lowercase “p”) to the Jobs post type, you just head to Jobs → Add New:

wordpress custom post type 2

And once you’re there, you’ll see that that the editor looks pretty much identical to what it looks like to create a new Post or Page:

wordpress custom post type 3

And once you Publish your job, you can view it on the front-end of your site where it, again, looks exactly like a post or page. Note the structure of the URL, though:

wordpress custom post type 4

Similarly, if you went to yoursite.com/job, you’d see a list of all the jobs, just like people see a list of all your blog posts when they visit your blog page.

How to Enhance Your WordPress Custom Post Type

Sometimes, the above approach might be all you need. For example, if you wanted to create a separate post type for “Reviews” at your site, you might want it to function the same as your regular blog posts.

However, a lot of the time, you’re using a WordPress custom post type specifically because you want it to be different from regular posts and pages.

To that end, let’s discuss some of the ways that you can enhance your custom post type.

Create Custom Taxonomies (Categories or Tags)

When you write a blog post, you know that you can add categories and tags to help organize your blog posts.

A custom taxonomy lets you add your own unique categorizer that functions like a category or like a tag.

Let’s go back to the “Job” example. You’d probably want a way to divide jobs by department (e.g. “Marketing”, “Admin”, etc.).

To do that, you could create a custom “Department” taxonomy. Then, visitors could choose to browse all the jobs for each department (much like visitors are able to browse all the blog posts in a specific category).

To create a custom WordPress taxonomy, you can use the same Custom Post Type UI plugin. Go to CPT UI → Add/Edit Taxonomy.

There, you can give it a name and choose which post type to “attach” it to. For this example, you’d attach it to the Jobs post type:

wordpress custom post type 5

Then, scroll down to the Settings section and look for the Hierarchical option. Essentially, this lets you choose whether your custom taxonomy behaves like a category or a tag:

  • False – acts like a WordPress tag.
  • True – acts like a WordPress category.

wordpress custom post type 6

Once you’ve finished, click Add Taxonomy.

Now, when you go to add or edit a new Job post, you’ll be able to add its Department as a category:

wordpress custom post type 7

Add Custom Fields to Collect New Information

Another thing you might want to do is collect additional information about each entry. That is, rather than putting everything inside the WordPress editor, you might want a separate way to add certain information.

For our Job example, that information might be:

  • Salary estimate
  • Type – e.g. full-time vs part-time vs freelance

To add this information, you can use something called custom fields. With custom fields, you’ll get a new box underneath the WordPress editor that lets you enter additional information – like this:

wordpress custom post type 7 1

The easiest way to add custom fields is with a free plugin called Advanced Custom Fields.

Once you install and activate the plugin, go to Custom Fields → Add New.

Give your field group a name. Then, click the + Add Field button to add your first custom field.

Pay special attention to the Field Type drop-down, as you’ll need to change this depending on the information that you want to collect.

For example, to show the number of the salary, you’d want a Number field type. You could also Prepend the currency symbol:

wordpress custom post type 8

For the job type, however, you’d want a Checkbox or Radio box field type, with the different job types available as options:

wordpress custom post type 9

Once you’ve added all of the custom fields you want to collect, scroll to the Location section and set the Post type / is equal to / Job. This tells Advanced Custom Fields that you only want to display these custom fields for the Job post type.

wordpress custom post type 10

Then, Publish your field group.

Change How Your Custom Post Type Looks on the Frontend

Finally, once you’ve collected all of this extra information, you’ll probably want a way to control how it looks on the frontend. That is, you might want to make it look different than a regular blog post.

There are a few different ways that you can do this, depending on your technical level and budget.

The most direct (and free) method is to actually dig into your WordPress theme’s template files and create a new single and archive page for your custom post type. For example, you could copy your single.php file and name it single-job.php and edit it from there.

However, this method assumes that you know at least some basic PHP, which might not be the case.

If you aren’t comfortable working directly with your theme’s template files, there are also some plugins that can help you customize the output of a WordPress custom post type using a drag-and-drop and editor.

Unfortunately, such plugins are not free – but if you’re willing to pay, check out:

  • Elementor Pro – $49 – lets you customize the design of your custom post type using the regular Elementor interface.
  • Toolset – $69 – a high-powered solution for working with custom post types in WordPress.
  • Post Type Builder – $49 – a simple option from Themify.

Or, another option is to use the free Pods plugin to both create and display your custom post types. Pods eliminates the PHP part of the equation and lets you design your content using magic tags and HTML/CSS.

So while you will still need some basic HTML/CSS to use it, it’s a lot simpler than editing your theme’s template files.

Get Started With WordPress Custom Post Types Today!

WordPress custom post types are one of those things that, once you understand them, can completely change how you work with WordPress.

Now, instead of trying to shoehorn everything into the default Post and Page content types, you can create your own content types to store and display unique content.

Get started today and experience the power of your first WordPress custom post type!

Colin Newcomer