As a WordPress user, you know that a Post is different than a Page.
Posts are displayed in chronological order by date from the most recent to the oldest on a main page. In its most basic form an excerpt of each post is displayed on one main blog page, you can click a link to read more, which takes you to a page dedicated to that posts content.
The various types of content WordPress can handle is known as post types. The most popular post types are pages and posts. Revisions, attachments, navigation menus, custom CSS, and changesets are also post types, but those are different from the post types that you can publish. This means if you want to publish content you have your choice between a post or a page. That’s great for many blogs, but it’s also limited.
What Are Custom Post Types
One of the advantages of WordPress is you can create your own post types. These are known as Custom Post Types. The image above shows a Custom Post Type called Cars.
A Custom Post Type has the functionality of a post, yet you may wish to create your own Custom Post Type in order to categorize your content. Custom Post Types are not like regular posts or pages. They don’t have to be published the same way that posts are, but they can be if you want them to. If you do publish them like posts, then they’ll have their own archives. If you publish them like pages they’ll have a hierarchy.
Quick Example: If you use the Divi theme, you will see the Projects navigation item on the left hand side of your WordPress Dashboard. This is a Custom Post Type. You know this because you have the ability to Add New, Add Categories or Tags.
Why Use Custom Post Types
Let’s pretend we are web designers (come on, use your imagination here people). We may have a blog for tutorials, industry news and opinions on products. We may also want to share our web designs and case studies for each new website we launch. It would make sense to use posts here, but we don’t want our design work to get lost in the chronological order of our blog posts. Solution: we use the Projects option in the Divi theme aka: a Custom Post Type. An example of a site Eileen just launched using Custom Post Types is TomatoGraphics.com.
Custom Post Types are helpful when you want to publish something other than posts or pages. For example, you might want to publish content that describes a product such as a book or a course, or you might want a specific type of post called Review with its own parameters that are focused on what you’re reviewing. Creating this content with separate post types helps you to distinguish one type of content from another.
All Custom Post Types have their own parameters. If you were simply writing book reviews, you could create a book review category. However, creating a book review Custom Post Type allows you to add parameters to that post type. For example, you could create meta such as genre, author, publisher, publish date, ISBN, price, etc. These parameters give your posts more features. The image above shows parameters that would apply to a car.
Post types have their own taxonomies, such as categories, tags, post formats, etc. You can create your own taxonomies for your Custom Post Types. Taxonomies can include things such as color, size, materials, events, a programming language, design tools, etc. They can have a hierarchy, so you can embed them.
Templates tell WordPress how to display the Custom Post Type. By default Custom Post Types use the Archive template, which is similar to posts, but you can create your own.
Custom Post Types can be displayed within posts, pages, widgets, etc.
Custom Post Type Example with WooCommerce
Many plugins create their own Custom Post Types. Examples include products, testimonials, reviews, ratings, coupons, events, listings, courses, etc. Chances are good you’ve already used Custom Post Types.
For example, WooCommerce creates a Custom Post Type called product. When you publish a product it’s associated with WooCommerce.
This is the Product post type that WooCommerce creates. It can have product categories, product tags, image, and gallery. It includes multiple types of fields and will display within WooCommerce posts. This example uses a car for the product. I’ve added field types for make, model, and mileage. We could also add mileage, age, tires, service history, etc.
How to Create Custom Post Types
There are several ways to create your own Custom Post Types. You can create them manually, which requires you to code them yourself, or with a plugin, which does the coding work for you. Plugins are the easiest and give you lots of great features. Just make sure you take your time and follow the instructions that each plugin provides. Here’s a look at the top plugins in the WordPress depository for adding your own Custom Post Types.
Custom Post Type UI
Custom Post Type UI is the most popular Custom Post Type plugin in the WordPress depository. It has an interface that makes it easy to register and manage Custom Post Types and taxonomies, which can be displayed with another plugin called Custom Post Type UI Extended.
Toolset Types gives you a dashboard menu where you can create Custom Post Types, custom fields, and custom taxonomies. You have full control over every feature, including associating taxonomies with Custom Post Types and integrating control over custom fields display for different post types. You can add custom fields for posts, taxonomy terms, and individual users using Access. This is great for creating membership levels.
Pods makes it easy to create Custom Post Types with custom taxonomies, custom settings pages, and advanced content types that use their own database tables. It includes lots of premade content types, field types, and relationships. You can edit a premade content type or you can make your own. It can be expanded to include even more features with add-ons. Pods also includes several widgets to display your Custom Post Types.
Example Custom Post Type with Pods
Here’s a quick example using Pods. Select Add New Pod in the menu and then choose between creating something new of editing an existing pod.
I selected Create New, chose the content type from the dropdown box, and give it a name.
Next, I added my fields and saved the Custom Post Type. These are the Custom Post Type’s taxonomies.
Now that my Custom Post Type is created I can create content using this post type. It works just like creating a post. I added the content and placed the information within the fields.
In order to display my Custom Post Type I have to create a template. The template is built from the fields that I created for this post type.
The new post types are added to the list and can be published within posts or used in other ways using shortcodes.
To display the Custom Post Type within a post add a shortcode and choose the post type and template.
The Custom Post Type now displays the content and fields that I created. I could continue customizing the display in the template files. This post type can be displayed in many ways within posts, pages, and other content. This is just a simple example. The sky’s the limit.
Custom Post Types are a great way to add new types of content to your website. Since Custom Post Types have the ability to add your own fields and taxonomies you have a lot of flexibility in the types of content you can create and how it can be published or used. Custom Post Types are not difficult to create when using one of the popular plugins.
We want to hear from you. Do you create and use your own Custom Post Types? Let us know about your experience in the comments.
Featured image credit: Photo by Domenico Loia on Unsplash
Thanks for the info, we just had a developer from Pods giving a presentation this Saturday at the WordCamp in Texas on this subject! It is very useful. What is missing here is the information on how to build a front end form, if I want visitors to fill in information, eg. people want to sell their used car on my platform…
Very helpful, thank you.