WordPress may have begun as a blogging platform back in 2003, but in the years since, it has evolved into a full-fledged content management system (CMS) that powers 30.7% of the web.

At the time of its inception, the only type of content you could publish was a “post”, which you could group into custom categories. In 2005, “pages” were added, as a second content type, turning WordPress into a CMS that could power your entire website. Pages can be nested under other pages, which lets you create a great site architecture, but aside from that, pages aren’t much different than posts. As a matter of fact, pages are simply a new “post type”.

There are other post types built into WordPress, as well. For example, every image or file you upload in the “Media Library” is actually a post with the post type of “attachment”. Even the menu items you add to your WordPress menus are posts with a post type of “nav_menu_item”. These post types make it easy for you to organize different types of content, and for many simple websites, these might be all you need. More complex sites, however, can benefit from adding their own post types to better organize their content.

Custom Post Types

In 2010, with the release of version 3.0, WordPress introduced “custom post types”. This lets you create your own post types to organize your content, furthering WordPress’s development as a CMS. Say your site has a “News” section that lists out your latest news articles. Prior to the addition of custom post types, you would probably create these news articles using the “post” post type and add a category of “News”. This works fine, and developers can write code that says, “get me posts with the category of ‘News’ and order them by publication date”.

A couple months later you want to add an “Events” section, so you create some posts and categorize them under “Events”. Then you get some testimonials from your customers and you add a “Testimonials” category. So on and so forth; you get the idea.

Now you have blog posts, news articles, events and testimonials all mixed together in your CMS, which isn’t logical. That’s tailoring your content to the CMS, when you should really be tailoring the CMS to your content.

By breaking your different types of content into their own post types, not only will it be easier for you to find what you’re looking for in the CMS, but developers will be able to customize the editing experience for each post type to meet your needs. If you reference the different post types mentioned in the above example, they are all very different. WordPress has setup the “post” post type perfectly for blog posts. You can add the post’s title, content, and an excerpt for post listings. However, an event, for example, needs some additional data like start date, end date and location.

Post Meta

With a custom post type setup, developers can now add additional fields, called “post meta”, to the event edit screen, creating an interface unique to your content. These post meta fields can, also, be used to sort and order your posts. By default, blog posts are ordered by publish date, showing the latest posts first.

This is perfect for blog posts, but isn’t ideal for our event post type. A typical pattern is to show upcoming events ordered by start date, showing the events closest to the current date, while excluding any events that have already occurred. This is no problem for developers since WordPress allows you to order by post meta values, in this case “start date”, and only apply that order rule to a specific post type(s).

Custom Templates

One of the greatest benefits of using custom post types is that they can have their own templates. What’s the good of having custom post meta if you can’t display it?

The WordPress templating system allows developers to create targeted templates that display the appropriate content for that post type. So, our event template can display the title, start date, end date, location and description; while a blog post can display the title, publish date, author, post content and comments.

Hierarchical Post Types

As mentioned earlier in this article, pages (just another post type) can be nested inside of each other. This is what’s called a hierarchical post type. When adding a new page, you have the option of selecting a parent page, letting you achieve something like this:

  • About Us – http://yoursite.com/about-us
  • Our Company – http://yoursite.com/about-us/our-company
  • Leadership – http://yoursite.com/about-us/leadership
  • Management Team – http://yoursite.com/about-us/leadership/management-team
  • Board of Directors – http://yoursite.com/about-us/leadership/board-of-directors
  • Careers – http://yoursite.com/about-us/careers

See how nesting pages also creates a nested URL structure? This makes it easy for users, and search engines, to navigate your site.

By default, post types are not hierarchical. The “post” post type is an example of a non-hierarchical post type. When adding a new custom post type, you should think about if it would benefit from being a hierarchical post type or not. It’s easy for developers to enable this feature for your post type, and it can even be done down the road, if you change your mind.

Custom Taxonomies

First off, a taxonomy is simply a way to group things. In WordPress, taxonomies are made up of “terms” which are used to group posts together. Similar to post types, taxonomies come in two flavors: hierarchical and non-hierarchical.

The “post” post type is a perfect example for both types as it comes with one of each built-in. “Tags” are a non-hierarchical taxonomy, while “Categories” are hierarchical and can be nested inside of each other.

Similar to post types, custom taxonomies can have their own templates as well. If you want a different template for your taxonomy, or even the terms within it, you can do that.

When considering a custom post type, it’s good to consider if you need a custom taxonomy as well. If you want to show a subset of the posts from your custom post type, or want your posts to be filtered or sorted in any way, then it’s likely that a custom taxonomy will serve you well.

For example, say your site has a Resource Library where you display videos, webinars, documents, white papers, etc. This is a perfect case to add a custom post type called “Resources” and a custom taxonomy called “Resource Types”, where videos, webinars, documents, and white papers are the taxonomy’s terms. As you’re adding resources you can group them according to their type and display those groups to your users. To view all videos you can go to http://yoursite.com/resource-type/videos, and WordPress will automatically display all the resources with the “videos” term. When using a hierarchical taxonomy, you can nest terms inside of each other.

So, if you had different types of videos, you could do:

  • Videos – http://yoursite.com/resource-type/videos
  • Patient Videos – http://yoursite.com/resource-type/videos/patient-videos
  • Doctor Videos – http://yoursite.com/resource-type/videos/doctor-videos

Additionally, with a little configuration, you can update the URLs of your post type to utilize your taxonomy terms. Continuing with our Resource Library example, the URL to a video could look like this: http://yoursite.com/videos/patient-videos/your-video-name-here.

Conclusion

Hopefully, by now you realize how powerful custom post types and taxonomies can be for your site. You’ll get a more manageable editing experience tailored to your content with the ability to add custom templates for your each post type and taxonomy on your site.

If you’re in the planning stages of a new site, or making some updates to an existing one, keep these features in mind. WordPress is a great CMS out of the box, but not every site can fit into posts and pages or categories and tags. Your site is unique and your CMS should work around your content, not the other way around.

Read another blog on content development and deciding if you should be outsourcing it.