How to create and manage Custom Post Types in WordPress
By Adarsh Sojitra on June 6th, 2022
Custom Post Types are one of the most powerful features of WordPress. It allows us to create custom posts and pages with the required contents. This unique feature can transform the Blogging Platform into a Powerful Content Management system and gives us important flexibility. So, if you have questions like What are custom post types, the difference between posts and custom posts, how to create custom post types, and how to display the custom post types on a website. Then, you’re on the right page. This article will learn all the important points about Custom Post Types in WordPress.
First of all, let’s understand the Custom Post Type in detail. And then, we will discuss why we need to create and use Custom Post Types. We will also learn how to create custom post types with step-by-step tutorials.
What are Custom Post Types?
The Custom Post Types are used to gather and arrange different contents. Whenever we use page and post, we’re using nothing but a custom post type. There are a few types available Post types. It is also used to differentiate between different content types. WordPress allows us to use many kinds of custom post types, and some are very familiar with you. Here you can see the list of Post Types.
- Custom CSS
- Navigational Menus
Let’s understand each post type briefly. So, we can easily understand the Custom Post Types.
The post means a simple post that we regularly use in WordPress. It’s a designed custom post used to create the content and post them on this server. It’s a dynamic content type, and developers regularly update it. So, to this date, we can use posts and add some necessary changes, then you can post them as an article. You can easily add categories and tags to display all the other content posts to the user.
Note: there are two meanings of posts in WordPress. When we talk about a post in this article, we will discuss the normal post. But as per the database of WordPress, the post is a content type. So it can be any post type as a page or attachment for the database.
The WordPress pages section contains another post type that WordPress site owners generally use. This post type is used to display or provide static content on the website, which we’re familiar with. The content of the pages has not changed, but still, it can provide enough information. For example, the contact us or about us page of any business website. The difference between posts and pages is that we can’t categorise the pages or can’t use any tags because it is not designed for them. The pages are regularly used on Navigational menus.
Each media file uploaded on your website will be considered an attachment. As per the WordPress database, the media is just data related to the content. In other words, the attachments will always have a unique ID and descriptions like title and alternative text. Each media file we upload on the WordPress website will have a unique URL. You can find the media file URL from the media section available on the dashboard of WordPress Admin Area. You can directly upload them to the media section and edit them as per our requirements. We can upload many types of attachments or media files like documents, images, and video files. We upload them to use on different pages and posts.
The revision word is perfect for this post type because we update any post, page, or media file each time. WordPress will create a revision version of the last or before update post in the revisions section. You can see the revisions of any post from the right-sided section. You can see Documents where details of an article like visibility and published date are displayed. Just below the details, you can see the total revisions, and you can click on that to see the revisions date time with user details. The revision post feature is essential because it can save the older version as a savepoint, so we can quickly revert it in one click.
The navigation menu item or navigation menu itself is a post type. Each navigation item is a post type stored as an item in the database, and each menu item has its unique content and identity. WordPress knows a navigational menu item very well. Each menu item where to display and most probably what to link is by default contents of this post type. And most importantly, we can change the menu items just like any other post or page. But each website builder can serve a different way to do it. The easiest method can be from the customizer.
Custom CSS is another type of post used to customise the current theme. We can use the Custom CSS post type from the customizer of WordPress. The code will be effective on the currently active theme, which can be relative to another theme, so each time you update Custom CSS., WordPress will generate another revision post.
The changesets are similar to revision post types. The only difference between a revision and changesets post type is that the revision post will be created when we change or edit any post or page. And the changesets are the set of changed settings for WordPress customizers. The settings you change in the customizer are Changesets.
Post VS Custom Post
As we discussed in the section above, a post is a type of post type, and it is used to display the content that belongs to it. Post is a simple post type, just like a page or attachments.
Custom post is also a post type but in the sense of all types of posts. So, do not consider a custom post type as a type of post in the manner of a blog post. We can add all the features of upon post types in the custom post types. This article will show you a plugin with UI based interface, so it will be pretty easy to understand the happenings.
Here you can see some examples of custom post types.
- A portfolio website will display portfolio posts
- A booking website has booking posts
- An eCommerce website contains product post
- A mapping site has maps as posts.
All the examples are just examples or regular uses of custom post types. And the custom post types have unlimited possibilities, like upon examples. It can be used with any website and ask for any data.
There are several ways of creating custom post types in WordPress. Some of the ways are very easy, but some need a very focused mind at the time of creation. So, let’s discuss some ways to create and display custom post types in WordPress.
Install Custom Post Type plugin
Creating a custom post type using a plugin is the easiest way. I strongly recommend this method to all beginners. The used plugin provides a UI-based interface to create custom post types. The plugin name is Custom Post Type UI. To use this plugin, we have to install it on our WordPress website. So, let’s start the tutorial.
Step 1: Log in to your WordPress website admin area using your Username and Password.
Step 2: Now, Hover your mouse on the Plugins tab section and click on Add New, as shown in the image below.
Step 3: Search for Custom Post Type UI won the search bar. Find the right plugin and click on the Install Now button, as you can see in the image below.
Step 4: Now, click on the activate button to activate the functionality of this plugin.
Now the plugin is active and we can create a custom post type in WordPress. You can also create custom post types by writing the PHP code, However, This plugin provides you an user interface to make the work easier.
Create a Custom Post Type using Custom Post Type UI plugin
Step 1: After activating the plugin, find the CPT UI option and hover the mouse. Then click on Add/Edit Post Types, as you can see in the below image.
Step 2: This is the simple version of creating a Custom Post Type. As you can see in the image, we have several fields related to Custom Post Types. Add all the details as per your requirement. We took an example of Movies for the explanation purpose, as you can see in the below image. Add all the details like Post Type and Label, and it will display by the label name.
Step 3: Then, click on the Add Post Type button.
Step 4: We just created simple custom post types. To edit this Post type, click on the second tab option available as Edit Post Types, as shown in the below image.
Step 5: Select the post you want to edit and click on it. Then scroll down and come to the second section as Additional labels, as you can see in the below image.
Step 6: This section will allow you to change all the additional labels like menu name and add a new item, new item, as you can see in the below image. Add all the necessary details about your custom post type.
Step 7: Now, scroll down and find the settings section, as you can see in the image below. These features are used to enhance the custom post-type usability. You have REST API support in this section. Change them according to your requirement.
Step 8: Now, again, scroll down a little and find the Support section, as you can see in the image. This section allows you to add new functionalities like page attributes, font formals, custom fields, and featured images. Click on the checkbox of the features you are required to add.
Step 9: Don’t forget to save the post type from the Save Post Button at the end of the page.
Now, let’s see how to display Custom Post Types. Follow the following tutorial.
Create and Display Custom Post Types
Step 1: On the dashboard of WordPress, find the Custom post type section from the left-side tab section. As per the following steps, I took an example of Movies, and then I have an option as a Movies, as you can see in the image below.
Step 2: Hover your cursor and click on the add new, as you can see in the image below.
Step 3: Add the title and content as per your requirement and click on the Publish button at the top right corner, as shown in the image below.
Step 4: You can see all the custom posts in the All Movies option, as shown in the below image. You can edit each post by clicking on the Edit link. Now, Let’s display the movies section on your Navigational menu.
As you can see, A custom post type is an alternative of the generic “Posts” or “Pages” you get when you install WordPress. It means that with the help of this plugin, You can easily create as many different post types as you want on your WordPress website. You can imagine things like “Journal Entry” or “Song” or “Guest post” or many other things that we cannot put in a generic “Post” or a “Page” type.
WordPress is a very flexible system that allows you to add custom post types using a plugin. It means that even a non-technical person with a small learning curve can modify or add new functionality in WordPress, just by using simple plugins made for different purposes. In this case, We created a whole new custom post type using a very easy to use plugin. With this customisation option available to you, The editing possibilities are unlimited. We hope you learned something new with this tutorial. If you have any questions, feel free to write them down in the comment section. We will respond as soon as possible with the answer.