Custom Post Types WordPress

Fantastic custom post types and how you can use them

The most widely used custom post type (CPT) in WordPress is probably the "portfolio". In addition to the well-known post types "Pages" and "Posts", you can create your own custom post types for a wide variety of purposes. But what are they? How do you create them? What are exciting uses and examples? An overview.

What is a WordPress custom post type?

Do you want to expand your website? And provide your users with more important content for your business or hobby website? Then you often need something more than just "pages" and "posts". For example, you might want to display recipes on your website, create a glossary, provide downloads, automatically list an employee overview or seminars - in addition to your blog news or current posts. Even a product in a web store plugin is a custom post type. There are basically two different types of custom post types:

  • Hierarchically organized custom post types
  • Chronologically organized custom post types

Let's take a look at both variants.

WordPress dashboard with the custom post types portfolio and recipes
WordPress dashboard with the custom post types portfolio and recipes

Hierarchically organized custom post types

This type of custom post type behaves in the same way as "pages". The entries are sorted alphabetically in the dashboard - just like the "pages". You can also add sub-entries to the main entries. As with the "pages", there are then sub-pages, the parent pages are called "parents" or "parents".

This type of custom post type is suitable, for example, for a glossary, a store list, your guitar collection, an employee list, something like a wiki or similar.

Chronologically organized custom post types

You've already guessed it: this type behaves in the same way as "Posts". The entries are saved and sorted in reverse chronological order so that the most recent entries always appear first - just like in a blog.

Classic use cases for chronological custom post types include recipes, a portfolio or events. It often makes sense to create custom taxonomies for these.

Custom taxonomies

The standard taxonomies in WordPress are "Categories" and "Keywords". These help you to further categorize the content and make it searchable. You can also create such taxonomies for custom post types. For example, an "ingredients" taxonomy for recipes, "singer/band" for songs or "publisher" for books.

This creates automatically generated archive pages on which, for example, only books from a certain publisher or only recipes with Brussels sprouts can be displayed.

The custom taxonomy ingredients
The custom taxonomy ingredients

How do I get my custom post type?

There are many different ways to create a custom post type, and therefore many different approaches:

  • A WordPress plugin that provides a custom post type
  • A WordPress theme that includes a custom post type
  • A plugin with which you can create a custom post type
  • You create a custom post type yourself in a plugin
  • You create one yourself in a theme

But what are the differences? Here is an overview:

Custom Post Type Plugin

The flagship plugin for this case is certainly something like an event or appointment calendar. This is relatively complicated to program. This is because it has to display posts that will take place in the future and you also have to create different views. In addition, there are numerous options and variables, such as displaying the organizer, location, time, location map, etc.

You might want to display different views, like a monthly list or a real calendar. This quickly becomes so complicated that you don't really want to program it yourself because it takes too much time (believe me, I've tried ?). There are also thousands of plugins for recipes, books, records and the like. So it's worth looking to see if there isn't something out there that exactly matches your ideas and requirements.

Of course, these plugins are often "Lite" versions. You can therefore extend the range of functions for a fee. An example would be a PayPal connection for your Zoom yoga classes or a quantity/person converter for your recipe ingredients. So take a close look to see if the Lite version includes what you need. Maybe you'd like to invest a little if you don't want to or can't program an extension yourself.

The right WordPress plugin

What would WordPress be without plugins? There are over 50,000 of them in the official directory. But it's like the proverbial search for a needle in a haystack to find the right ones in this jumble of extensions. This article by Torsten Landsiedel will help you make the right choice.

Custom Post Type Theme

The most common thing we encounter here is certainly the portfolio function, which many photographers, designers, agencies, artists and copywriters need.

I always see this as a bit of a problem: the function is of course super practical if that's exactly what you need. But what happens if you want to change your theme in three years' time? In the worst-case scenario, your laboriously filled custom post type is gone with the theme change - and you can create all your entries in the portfolio again. Only experienced developers can then retrieve the entries with a programmed plugin. In most cases, however, the various archive pages will have to be redesigned, etc.

So I would think carefully about whether I use the function of the theme. Or whether I might find a plugin that can do the same thing. Then you can continue to use the plugin after a theme change - and be happy that all the content is still there.

A plugin with which you can create custom post types yourself

Yes, that also exists. With some tools, custom post types can be created and then filled without much effort. So if you need something special but don't know how to program, this is the way to success. For example, you can create a list of sponsors or display pharmacies that belong to an association. Or the members of your bowling club or other special things.

In combination with Advanced Custom Fields, for example, you can also create a wide variety of applications. Michael Hörnlimann describes how this works very well in his article What are Advanced Custom Fields (ACF) in WordPress. This is what the backend of the Custom Post Type UI plugin looks like:

The WordPress plugin Custom Post Type UI
The WordPress plugin Custom Post Type UI

Create a custom post type plugin yourself

The most beautiful of all possibilities is certainly also the most difficult. Creating your own plugin for a custom post type presents you with two hurdles: "How do I program a plugin?" and "How do I program the custom post type?". However, there are actually numerous simple DIY instructions for this in the WordPress universe. And with a little internet searching, you can usually even find your own use case.

Once you have understood the various setting options, you have the opportunity to design a custom post type entirely according to your own ideas. If you are also good at creating templates that display this custom post type, then your possibilities are endless. In combination with Gutenberg, you can then create very appealing entries.

Programming a custom post type
Programming a custom post type

Create a custom post type in your theme

Just for the sake of completeness: You can also create the custom post type in your theme. However, I do not recommend this, as your custom post type will also disappear if you change your theme. With your knowledge, you can of course reintegrate it into your new theme. However, you can save yourself this step if you use a plugin.

In the theme, you can design the views of your CPT archive and the CPT single view, if they require customization at all. It is much more complicated to do this with a plugin. Thanks to Gutenberg, however, you can at least design your individual views extensively yourself. With a simple plugin like Duplicate Post, you can then duplicate your entries and customize them for the new entry.

Examples of custom post types

A glossary for SEO purposes

Please don't argue with me whether it makes sense SEO-wise to create such a collection. I actually don't know whether it makes sense or not, because I'm not an SEO expert ?

The idea at the time was to create a glossary for the various terms so that the terms would appear in the web search or increase in relevance through internal linking.

I implemented the requirement with a hierarchical custom post type for the individual terms. I also programmed a list that can then be accessed via the letters. It is a practical example that can be used for many applications:

The theme glossary in WordPress
The theme glossary in WordPress

Appointment calendar for a dog school

A classic example of an appointment calendar, which then shows the training sessions and workshops that will take place in the future. The dog handlers can use the simple overview to select and book an appointment.

I implemented this with the Events Manager plugin. This offers a wide range of options - actually a little too many for such a "simple" task. But programming it myself would have been far too time-consuming in this case.

An appointment calendar with WordPress
An appointment calendar with WordPress

Personal recipe collection

I recently created a chronological custom post type for recipes for myself. There are taxonomies for occasions and ingredients, the rest was created with Gutenberg. I left the view of the archive page in the design of my blog. So nothing had to be developed additionally.

Of course, there are also numerous plugins for this. In this case, however, I wanted to have it exactly as I imagine a recipe page. I could imagine a similar approach for travel reports or a separate photo blog in addition to your own news.

custom post type recipe
The collection of recipes

Download area in WordPress

For this purpose, the customer wanted a simple upload in the backend for his downloads, sorted chronologically. The PDF upload was implemented via Advanced Custom Fields, and I had to force WordPress to automatically display the first page as a screenshot programmatically. Users can also filter the downloads using the "Areas" and "Keywords" taxonomies.

A separate download area
A separate download area

My conclusion on custom post types

Custom post types in WordPress enable a variety of applications to extend your website. With the right tools, you can quickly create custom post types yourself. Important content for your users can be displayed with appealing archive pages and stylish individual pages.

Automatically created archive pages allow you to filter and search the post type. Taxonomies extend the function of CPTs by automatically creating archive pages for the respective taxonomy terms. Do you have any other great examples? Then let me know in the comments.

Your questions about custom post types

Do you have questions for Phillip? Or about the possibilities of custom post types? We look forward to your comment. Do you want to be informed about new posts about WordPress? Then follow Raidboxes on Twitter, Facebook or via our newsletter.

Did you like the article?

With your rating you help us to improve our content even further.

Write a comment

Your e-mail address will not be published. Required fields are marked with *