What are custom post types? And why do you need them?

Posted by on

When we want to add a new blog post or an article, we create a new post. We then write the content, assign the category and add a featured image to the post.

The problem arises when we have multiple kinds of posts. Say, we have case studies, tutorials or podcast show notes along with its audio player.

Now, adding all these content types under posts is not a good idea. It is a management nightmare. Once you have more than a hundred content items of different types, then managing all these posts, is going to be a tedious task.

That’s why WordPress provides us with functionality, using which we can add custom post types. That means you can add a case study under the case study section; you can add show notes under the podcast section.

Advantages of using custom post types

  1. Ease of management
  2. Can add categories specific to the content type. So that you don’t have to use the same categories you use for the blog posts.

As you can from the screenshot below, my website has multiple post types like Podcast, Courses, Lessons and Sections.

custom post types

So, how to add a custom post type?

There are two ways you can add a custom post type to your WordPress website. One is through adding code in your functions.php file, which is not very intuitive if you are not a developer or have some experience with programming.

function create_post_type() {
  register_post_type( 'acme_product',
    array(
      'labels' => array(
        'name' => __( 'Products' ),
        'singular_name' => __( 'Product' )
      ),
      'public' => true,
      'has_archive' => true,
    )
  );
}
add_action( 'init', 'create_post_type' );

This code is taken from the WordPress documentation.

As you can see, this is gibberish if you don’t have a development background. This code will add a custom post type called Product in your WordPress site.

But that’s ok!

As they say, whenever there is a problem, there is a WordPress plugin 😀

Now, multiple good quality plugins help us in creating a new post type. But the best one I feel and I use whenever I need a custom post type is Pods.

Pods plugin provides us with an interface that makes it super easy to add a new custom type.

So, follow these step by step instructions to create a new custom post type.

Search for Pods to add new plugin interface in WordPress

search pods

Click on Install Now and once installed click Activate.

install pods

activate pods

Once activated, you will find Pods Admin in the left-hand side menu. Click on it.

create custom post types using pods

Click on Create New

create new

Select the Content-Type as Custom Post Type and type the Singular label and plural label for your post type. Let’s say the custom post type is a project then singular will be ‘project’ and plural will be ‘projects’.

In the following example, I will a case study as a custom post type. Click next step once done.

add new custom post type

Now you can see there’s an additional option in the admin menu ‘Case Studies’

case study option

Now if you will click case studies, you will find a similar interface as that of posts.

There are multiple options that Pods provide, which helps us in customising the custom post. Some of these options are whether we need an author for the post, does that post have a featured image or does it have a page that enlists all its items (like a page that will show all the case studies).

 

So, create a new post and make sure your content is organised and not laying here and there.

If you want to check out the custom post type on my website, head over to podcasts.

Best of luck with the custom posts!

>