Post Types, in WordPress, are different types of content. Don’t let the name “post type” confuse you – it actually refers to any type of content. A more accurate way of describing it would be as a content type.
Contents
WordPress Default Post Types
There are five default post types that come with WordPress, all of which you’ll be familiar with:
- Posts
- Pages
- Attachments
- Revisions
- Nav Menus
Custom Post Types
Custom Post Types are post types that are created in addition to those bundled with WordPress core. When you activate a theme or a plugin you may find that the developer has included custom post types. Or you may decide that the functionality you have isn’t adequate to your needs, and decide that you need to create your own.
Uses for Custom Post Types
Custom Post Types are used in a wide variety of ways across the WordPress ecosystem. Any time you need a content type that is different to the default types, you’ll need to start thinking about them. Some examples of how they are used are:
- Products for an ecommerce site
- Testimonials and a Showcase for a web portfolio
- Listings for a real estate website
- Reviews for a gaming website
- Events for an event calendar
- Vehicles for an Automotive website
You can create a post type for each of these, give them their own additional data and taxonomies, and then output them using your theme. This increases the flexibility of WordPress as you’re not limited to the content types that it comes bundled with.
Creating Custom Post Types
If you code Custom Post Types yourself, you do this be registering the post type in the functions.php
file of your theme, or in a plugin. Within this you can define the properties of the post type and how it acts within WordPress. The WordPress Codex has a guide to Post Types with information on coding them.
A plugin like Pods takes care of all of that coding for you. You can create the post type from your WordPress Admin, assigning all of the different properties and values that you need. This means that you don’t need to be a coder to make use of WordPress’s flexibility.
To make full use of Custom Post Types, you’ll also need to learn about WordPress Taxonomies and Custom Fields.