By default, WordPress has 5 different post types – post, page, attachment, revision, and navigation menu. All post types enable content to be displayed in some way. However, using custom post types greatly extends your possibilities of organizing and displaying content anyway you want.
By combining custom post types and taxonomies, you can achieve more granular organization and display of content on your website. With custom post types and taxonomies, the sky is the limit regarding what content you want to put on your site and how you want it to appear.
In this post, we’re going to discuss a couple of situations where custom post types and taxonomies are the best option. Although the default post types are more than sufficient for most websites created primarily for blogging purposes, you need custom post types and taxonomies to create a truly unique and powerful non-blog WordPress website.
Custom post types work with the single.php template by default. However, it is better to create a custom template of the format single.template-name.php for it.
The Basics of Custom Post Types
Custom Post Types are simply user defined post types added to a theme. While the word post is used in the name, they actually have little to do with regular WordPress posts. They are more about custom pages and are best suited for creating mostly static-like content pages for a website.
A taxonomy is essentially an extension of categories and tags. As with categories and tags, taxonomies are used to create groupings (or granular categorizations) for your content. You can use taxonomies for regular post types but their true power is best exploited when used to group content created using custom post types.
Both taxonomies and custom post types can be created using either the plugin method or by hand-coding.
Creating E-Commerce Product Pages
One of the most common uses of custom post types and taxonomies is the creation of product pages or catalogues for e-commerce sites. Since products are typically grouped into multiple categories and subcategories, creating custom taxonomies for your groupings is the only logical way to achieve that.
In the case of a product page, you’d typically start by creating it for products and then use a custom taxonomy to organize the products into categories.
For a developer, hand-coding them in a theme gives you a lot of control over how your page appears. That being said, plugins are always available if you need simple custom post type content.
Creating A Portfolio Page
Like a product catalog page, portfolio pages in WordPress are best built using custom post types. Portfolio pages typically display static content – your past or current projects – in some form of list or grid.
Again, as with the product page, you start b y creating a custom post type for the portfolio and then create a taxonomy for your portfolio items, which basically created categories for your lists.
Or instance, you can create a taxonomy called Competencies and then populate it with items such as PHP, HTML5, jQuery, WordPress and so forth.
Real Estate Listings
Pages that display real estate listings on a WordPress website most probably use custom post types to achieve that. Every real estate site uses a different listing criteria but the basic idea is to create a custom post type (such as real-estate) and then provide filtering for the properties using taxonomies. The concept is similar to the previous two examples.
Listing simple events on a page is possible and easy using custom posts and taxonomies. Using the e-commerce analogy, you would create an Event custom post type and then categorize the events using taxonomies. Any other functionality is then easily integrated.
You’ve probably noticed a pattern in the types of situations where custom post types are indispensible: custom listing or cataloguing is where custom post types excel. That being said, there is no limit as to what type of content you can display using custom post types. Once you grasp how to use them, they can open up a whole new world of possibilities for your WordPress website. E-shops, event listings, real estate listings, and portfolio listings are a few of the applications you can build on WordPress using custom post types but there’s really no limit to what you can achieve.