WordPress was originally created as a blogging engine. It had posts and pages, which gave it all the flexibility it needed to support traditional blogs. To be properly regarded as a content management system, WordPress needed a more flexible way to arrange content. Custom post types were introduced way back in WordPress 3.0 and allowed WordPress users to publish content that wasn’t limited to the post-and-page model.
First, let’s clear up a bit of terminological confusion between post and post type. A post — think a blog article — is a piece of content with the post type post. A page is a piece of content with the post type page, and so on for several default post types.
In addition to the default post types we can create custom post types with different properties to the defaults, like different categories and different fields in the editing interface. They also appear in the admin menu just like posts and pages do on a default install.
Let’s consider a more concrete example. You own a blog on which you publish reviews of travel equipment: backpacks, walking shoes, tents, and so on. You publish this blog as you travel the world testing the equipment. Your blog posts are split into various categories based on the type of review you’re doing. So far so familiar; this is a fairly typical way to use a WordPress site.
But you’d like to add a different sort of post to the site: one that tracks your travels and includes photos and details of the destinations you visit. You could just add another category to the taxonomy of your blog posts, but you’d rather keep that clean and create a new section to your site entirely. Custom post types are great for this.
Why choose custom posts?
- Your travel posts get a separate entry in the admin menu.
- They’re grouped under their own section in URLs, e.g. www.travel-stuff/my-adventures/thailand-photos.
- These posts can have a taxonomy of categories and tags entirely separate from the review posts.
- You can add custom fields to these posts to integrate information into the pages. Perhaps custom fields for map coordinates, temperature, ratings, and so on.
While it’s possible to create custom posts by editing the site’s PHP files, there’s an easier way to do it with the Types plugin. If you want to get your hands dirty in the code, take a look at this guide from Elegant Themes.
Types is a plugin that brings an intuitive way to build and custom post types along with taxonomies and fields from within WordPress without having to edit a character of code. It makes it relatively straightforward to build new custom post types along with associated fields and taxonomies.
Types is a powerful tool, so instead of walking you through what it can do, I’ll point you in the direction of the plugin’s excellent documentation.