Custom post types is the feature that pushed WordPress from a blogging platform into a full-fledged content management system. They help organize, relate, and manage content better than ever. The best part is that you don’t need to be a developer anymore to take advantage of this awesome feature. One solid plugin is all you need to be on your way!
What Are Custom Post Types?
Custom post types are content types, like posts and pages, but with a lot more freedom. They aren’t expected to be timely or in an article format, like blog posts. They work well with a feed loop, custom fields, and excerpts, unlike pages. In short, they can be pretty much what you want them to be.
Here are some common uses: hotel listings, a portfolio of work, testimonials, properties, and staff. Some of these custom post types can even work together, like a post type for both events and venues.
When Should You Use Custom Post Types?
It is very tough to give a definitive answer, but the following guidelines should help you out:
- The content doesn’t fit into the blog/pages
- Content needs its own set of taxonomies (categories, tags, etc)
- Content will be fed into a custom loop(s)
- Ease of use compared to pages
Setup And Plugins For Custom Post Types
There are many great options, free and premium, for creating custom post types, taxonomies, and custom fields.
Free Plugins on WordPress.org
- Toolset Types
- Custom Post Type UI
- Easy Content Types
I personally love the Toolset Types plugin and will be using that option for the rest of this post.
Setting Up A WordPress Custom Post Type
Install and activate the Toolset Types plugin. Head to the Toolset/Post Types and click “Add New.” Enter in the title, both singular and plural, along with the slug. The slug is used in the permalink for the posts. It is good to be very selective in picking the slug as changing it later can break a lot of links, loops, etc. Lastly, pick an icon that makes sense with your post type.
On the same screen, you will have the option to edit the labels. Generally, I leave these fields unchanged but they can be useful for being more descriptive.
The Sections portion of the setup is very dependent on your post type. The Title and Editor options are turned on by default. I’m creating one for real estate property so I didn’t want to worry about Comments, Trackbacks, or Revisions. The author option wouldn’t even make sense for this content. I turned on the Excerpt option for greater editorial control and the Thumbnail so that the featured image could be pulled into loops.
The post type is ready to launch! Once it is live, you can go ahead and start entering in new posts. The editor will look very similar to a post or page depending on the options you selected.
Displaying Custom Posts
The easiest option is the native WordPress archive loop. All you have to do is navigate to mysite.com/property/. You can see this in action with the CYBERsprout portfolio. The loop will look a bit different than the default loop as we are utilizing the Genesis framework and Grid Loop plugin.
Another option is to add posts to the sidebar with Recent Posts Widget Extended. Unlike the default WordPress Recent Posts widget, it supports custom post types. It also comes with a slew of additional options for the display, sorting, and filtering. I used this widget to add a random display of the Property posts to the sidebar.
If you would like to do more with the display of custom post types, check out the Toolset Views premium plugin. It has easy options for creating custom content templates and views.
Custom Taxonomies For Post Types
Taxonomy is really just a fancy word for categories or tags. Being familiar with categories, you know how helpful they can be for organizing content. It is no different for custom types. You could use the WordPress default post categories and tags for your post type, but it rarely makes sense.
It is far more sensible to create a custom taxonomy for your post type. The most logical for my post type was the taxonomy “Home Type.” The name and description setup is similar to that of the post types. For the Taxonomy Type, you have the option of Hierarchical or Flat. The post categories would be an example of hierarchical where there are checkboxes and the option for subcategories. The post tags would be Flat with an open editor for numerous options and no tiered options.
While the “Home Types” taxonomy was set up as hierarchical, I decided to add the “Features” taxonomy as flat. There are an endless number of features with no need to add priority to any one feature.
The options are endless and you can add as many taxonomies as you want for each post type. Some examples for real estate could include area, agent, bedrooms, bathrooms, prices, and status. You can also have taxonomies be associated with multiple post types.
I used the List Custom Taxonomy Widget plugin to easily display the taxonomies on the sidebar to allow visitors to sort through the Properties.
Want to go deeper with your content? It is possible to create a parent-child relationship between two different post types for more sophisticated content. In the case of my Property post type, I wanted to add a more detailed description of each room without adding too much to the property description. I created a Room post type in the same manner as above except I selected a post-relationship as well.
Once the child post type is setup, you’ll see a new option at the bottom of every Property entry. I can now add and remove rooms for each property. To add more detailed content, I would need to open each child post by clicking “Edit.”
WordPress will not automatically display these child posts along with the parent post. I used the Post Connector plugin to make this happen.
Final Look And Notes For Custom Post Types For Non-Developers
The final view of one post with Property post type is below. You can see the content for the post, child posts below, taxonomies in the top of the sidebar, and random other properties below the taxonomies.
The best advice I can give is to jump in head first. Play around with custom post types on a test site to get a feel for their power. It may seem like a simple concept, but there are an endless number of ideas and possibilities when you start to truly understand custom post types.