Custom post type in WordPress is an effective tool to convert a WordPress site from being just a simple blogging site to a Content Management System (CMS). On WordPress installation, you get five built-in content types – pages, posts, media, revision, and attachment. But, there is more to content than simply blogs and posts. Using WordPress custom post type plug-ins or manually, you can create magic, literally because they let you go beyond the standard blogs, pages, and media.
In this context, we are going to learn the step by step process of creating a custom post on the WordPress website. Use the best plug-in to create customized content for any type of website.
How to Create Custom Post Type in WordPress Step by Step?
WordPress 3.0 came with revolutionary custom post types. So what are custom post types? These are plug-ins that allow you to place the content into separate segments. You can now develop several innovative content types. These enable you to make your own custom posts.
For example, if you wish to cover more than one topic using the conventional sections, all the topics even if categorized under different heads will all feature under the Post section. However, if you use custom post type in WordPress, you will be able to show different categories in different sections.
So use content post type when you need to publish content that has to be kept separate from pages and posts.
Step by step process to create custom post type in WordPress
There are two ways to create custom post type –
1. Manual method
2. Simplified method
How to create a custom post type in WordPress – Manually?
The advantage of creating the custom post types manually is that you do not use any sort of plug-in. When you use plug-ins, the custom post type will be deactivated when the plug-in is disabled. Though the information contained with the custom post type will not disappear, the custom post type itself will get deactivated.
The manual creation of content post type in WordPress is ideal when you do not wish to add another plug-in.
- You can add custom post type manually by adding the code in functions.php.
- You need to write a new function – register_post_type() function.
- This function has two parameters.
- One is the name of the post type that should be less than 20 characters without any space or use of the capital letter.
- The second is the associate array which says what the post type is all about – it describes the post type.
- To register the custom post type in WordPress you will need to hook the function to the init action hook.
- Also, ensure that all custom functions are prefixed and made unique. This avoids conflict with other functions, like the theme or other plug-ins.
The manual method to create custom post type in WordPress needs proficient coding knowledge. It is therefore advisable to hire the services of a leading WordPress web development Company. AvyaTech is one such reputed web application development company in India that has a competent technical team of WordPress web developers.
How to create custom post type in WordPress – Simplified method?
If you wish to create custom post types all by yourself, without much professional help; it is advisable to use the easy way. This involves the use of WordPress custom post type plug-ins.
If you have just begun your WordPress development journey, then you must go in for the plug-in method.
Step no. 1# Install Custom Post Type UI plug-in. This is an interface that is easy-to-use and helps register custom post types.
Step No. 2 # Once the plug-in is activated, it will add a new menu called CPT UI in the admin menu.
Step No.3 # All you need to do to create a custom post type is to go to CPT UT> Add New.
Step No. 4 # Now, the first thing to do is to define a slug in the custom post type. ‘Slug’ is actually the name of a post. You will need to define the post name using letters and numbers only.
Step No, 5 # After this, you will be asked to add the plural and the singular custom post type name.
Step No, 6 # Now you have the option to click on the field ‘Auto-populate labels’. This option will automatically populate additional labels based on the chosen labels.
Step No, 7 # In the Additional Labels section, go to Post Type description to describe the custom post type.
Step No. 8 # The next thing to do when using the WordPress custom post type plug-in is to go to the Setting option to set various attributes of the custom post type. So, there are attributes like Public, Publicly Queryable, Show UI, Show in Nav Menus, and Delete with user options.
Step No. 9 # After this, you need to go to the Supports section below the general settings. Here, you will be able to select the attributes that you wish to have to be able to edit the post type. The attributes are Title, Editor, Featured Image, Excerpt, Trackbacks, Custom Fields, Comments, Revisions, Author, Page Attributes, Post Formats, and None fields to select from.
Step No. 10 # In the final step, you will need to click on the ‘Add Post Type’ to add and save the new custom post type.
After this, you simply start work on your content.
One debate that seems to be perpetually occupying developers is to choose between coding and using the plug-in to create custom post types in WordPress. Using the plug-in is a good idea when there is a requirement to change the WordPress theme later- using a plug-in makes the code and the data portable from one theme to another.
It is best to have a professional WordPress web development company to develop a custom plug-in for every custom post type. This enables two things – maintaining data integrity, as well as, keeping the custom post type separate from the theme. As a website owner, you have greater flexibility should you choose to move from one theme to another.