WordPress Custom Post Type. What It Is and How to Create One?

Updated: November 7, 2020

The ability to create a Custom Post Type is one of the features offered by WordPress. You might be wondering, what is a Custom Post Type? We will find the answer in this article. So, read on.

First off, you need to recall that WordPress is not merely a blogging tool. Instead, it is a robust, customizable content management system that you can use to create any type of website outside blogs. Even so, the brand new WordPress installation indeed looks like it is merely a blogging tool. Every article you published will be displayed on the homepage by default. In WordPress, blog post (article) is one of the examples of Post Type. In addition to blog post, there are several other default Post Types in WordPress.

Referring to this documentation page, there are 5 default Post Types in WordPress:

  • Post (blog post)
  • Page
  • Attachment
  • Revision
  • Navigation Menu

So, what is a Custom Post Type?

A Custom Post Type is a new Post Type that you create for a certain need. For instance, if you want to create a bike rental website, you might want to create a Custom Post Type for bikes you offer and add custom fields that are not available on the default Post Types. WooCommerce is one of the best examples of how a Custom Post Type is implemented. In the context of WooCommerce, the Custom Post Type is Product.

In WordPress, Custom Post Types are treated differently than Default Post Types. They won’t be displayed anywhere unless you manually display them.

How to create a Custom Post Type

There are always two ways to achieve things in WordPress: manually and using a plugin. If you have PHP knowledge, you can add a new function to create a Custom Post Type. To do so, go to Appearance -> Theme Editor and paste the following code:

function create_posttype() {
 
    register_post_type( 'bikes',
        array(
            'labels' => array(
                'name' => __( 'Bikes' ),
                'singular_name' => __( 'Bike' )
            ),
            'public' => true,
            'has_archive' => true,
            'rewrite' => array('slug' => 'bikes'),
            'show_in_rest' => true,
 
        )
    );
}
add_action( 'init', 'create_posttype' );

Alternatively, you can use a plugin to create a Custom Post Type. Some plugins that you can use to create a Custom Post Type are:

In this post, we will show you how to create a Custom Post Type using Pods. It is a free plugin so that you don’t need to spend a dime to use it.

After installing and activating the Pods plugin, go to Pods Admin -> Add New on your WordPress dashboard. Since you want to create a Custom Post Type, click the Create New option.

On the Content Type option, leave it to default (Custom Post Type). Give the singular label as well as the plural label on the respective fields. If you want to give your pod a name, you can click the Advanced link. Click the Next Step to continue.

  • Singular Label: The label for 1 item (Singular) that will appear throughout the WordPress admin area for managing the content.
  • Plural Label: The label for more than 1 item (Plural) that will appear throughout the WordPress admin area for managing the content.

Next, add the custom fields according to your need. You can read our previous article to learn more about WordPress custom fields.

To add a custom field, you can click the Add Field button under the Manage Labels tab.

Add the field label, field name, field description, and select the field type. If you want to set this field as a required field, simply tick the Required option. Click the Save Field button to save the custom field.

Repeat the steps above to add more custom fields to your Custom Post Type. Once done, switch to the Labels tab to set the labels of your Custom Post Type. In case you don’t know, labels refer to menu texts that appear on the WordPress dashboard.

Next, switch to the Admin UI tab. From this tab, you can disable/enable some options such as whether you want to the Custom Post Type in the admin menu, add a menu icon, and so on.

Once done making the settings on the Admin UI tab, you can switch to the Advanced Options tab. From this tab, you can enable the attributes you want such as title, editor, featured image, author, and so on. You can also add the taxonomies for your Custom Post Type. Once done, you can click the Save Pod button to publish the Custom Post Type.

That’s it. Your Custom Post Type is now ready to use. To add new content to your Custom Post Type, you can go to New -> Your Specified Label from the top bar or Your Specified Label -> Add New on the sidebar inside your WordPress dashboard.

How to display the Custom Post Type

There are two ways to display the content of the Custom Post Type you have just created. First, you can display the content using PHP code. Second, you can use a plugin. One of the plugins you can use to display your Custom Post Type is Elementor. In this article, we will show you how to display the Custom Post Type using Elementor. You need to use the pro version of Elementor to display your Custom Post Type as the Elementor widget to display Custom Post Type — the Posts widget — is only available on the pro version.

Before getting started, make sure you have installed and activated Elementor Pro on your Elementor website. If you are new to Elementor, you can read our previous article to learn how to use Elementor. In this article, we will go straight to adding the Elementor widget.

Drag the Posts widget to the canvas area.

By default, the Posts widget displays the blog posts on your website. You can edit the query to make it displays your Custom Post Type. To do so, open the Query block under the Content tab on the left panel. On the Source option, select the Custom Post Type you have just created from the dropdown menu.

That’s it. You can then go to the Style tab to style up the appearance of the content of your Custom Post Type. You can read this article for more detailed instructions on how to use the Posts widget.

The bottom line

The ability to create Custom Post Type is one of the features offered by WordPress as an open content management system software. Thanks to this feature, you can use WordPress to create any type of website outside a blog. Basically, most WordPress-based websites such as property sites, travel agent sites, e-commerce sites, and so on make use of this feature. Coupled with custom fields, Custom Post Type could be a powerful feature to unleash the power of WordPress.

This page may contain affiliate links, which help support WP Pagebuilders.

Leave a Reply

Your email address will not be published. Required fields are marked *

Pin It on Pinterest

Share This

Share This

Share this post with your friends!