WordPress came a long way from being a simple blogging platform to becoming one of the most popular content management systems. Its origins are obvious when you consider the fact that WordPress, as complex as it became, still comes with types of content such as posts and pages just like any other blogging platform. Today, however, you can set up as many additional types of content, or custom post types, as you want. In this article, we’ll take a closer look at what custom post types are and what functionalities they offer.
Introduction To Custom Post Types
Even though they’re called custom post types, you need to keep in mind that they’re not necessarily always posts. As mentioned earlier, WordPress started out as a blogging platform, and the term post stuck. By default, WordPress comes with these post types:
- Nav Menu
All of them are stored in the posts database table and are differentiated by a column called post_type.
Key Differences Between Posts And Pages
Beginners are often not sure about the differences between a post and a page. They have similar fields in the dashboard, and they look pretty much the same on the website, so why do we need both? If you’re running a blog, you’ll deal with posts most of the time. They’re content entries ordered in reversed chronological order, and can be archived, categorized, tagged, and even commented. Pages, on the other hand, don’t support comments and can’t be categorized. They do allow, however, creating sub-pages, which means they’re hierarchical.
Why We Need Custom Post Types
Even though you can include any type of content in posts and sort them using categories and tags, that’s not always really practical. This is where custom post types come into play to save the day. Say you want to build a portfolio. You could, theoretically, share your work in a series of blog posts, but your work would easily get lost. Creating a portfolio post type will enable your visitors to easily browse through all of your work.
In addition to creating custom post types, you can add custom taxonomy for sorting portfolio items between portrait, wedding, and fashion photography if you’re a photographer, or web design and logo design if you’re a designer. Custom post types are also great when you need additional fields to enter more information with your content or you need to display that particular content differently than posts or pages.
Creating And Using Custom Post Types
While you can create custom post types manually, there are third-party plugins that can help you, especially if you’re a beginner, because it’s a lot safer and incredibly easy. Once you create a custom post type and define its taxonomy, you’ll want to go to Appearance » Menus and add a custom link to your menu. When a visitor clicks on the new link in your menu, your custom post type archive page will be dispayed using the archive.php template file in your theme.