Navratri Festival Sales 20% discount on all products, use coupon: NAVRATRIFS20

How to Create Custom Post Types in WordPress

How to Create Custom Post Types in WordPress

Do you want to create custom post types within your WordPress site? It was a very simple way to do it. WordPress has many different post types. Each post type has specific functionality that users can use in the dashboard. In default WordPress having posts, pages, media and menus are different types of post type. 

Additionally, We will create our own custom post types. If you are a beginner in WordPress, It is the right place to learn the WordPres post types. Before you want to create you have to know what is a custom post type?. It was shortly called CPT in WordPress. Let me explain briefly in the below.  

Once you have login your PhpMyAdmin and choose your database name as you have mentioned on your wp-config.php. Then choose the wp_posts table. Here you can see a list of those custom post types in the table along the ones that already exist. 

WordPress Post Types PhpMyadmin

WordPress Post Types

  • Post
  • Page
  • Media
  • Revisions
  • Menu
  • Custom CSS
  • Templates

1. Post

A post can display the information with separate categories and tags lists. It has a more convenient way to display the article to the users. A powerful edit feature allows your posts to edit or add any widgets inside. You can look at the section of Dashboard -> Posts. While you create a new post, It stores a custom post type name as “post”

2. Page

A page can include details and display the contents like home, about, and contact pages. You can add as many pages to your site . And also you can update your pages as many times as you want and draft. Here you can choose as Dashboard – > Pages. While you create a new page, It stores a custom post type name as “page”

3. Media

Media consists of the images, videos, audios, PDF, Docs, icons and other file formats. Here WordPress will arrange  the images as date or year wise. All the uploaded items or objects as stored in this Media section. As if you look at the section of Dashboard -> Media. It stores a custom post type name as “attachment”

4. Revision

WordPress Revisions allow you to revert to an earlier version of a post or page edits. WordPress has autosaves your every edit and it stores revisions for each post or page custom post type name as “revisions”

If you want to see the revision as Post -> Edit on the right sidebar as you can check the no of revisions. If you want to limit the revision use below the code on wp-config.php

define('WP_POST_REVISIONS', 5);

5. Menu

A navigation menu section contains links to pages, blog posts, and other contents so that your visitors can easily navigate around your wordpress site. Furthermore you can create custom links as menus. WordPress navigation all menus section visible at Appearance -> Menus. While you create a new page, It stores a custom post type name as a “nav_menu_item”

6. Custom CSS

Custom CSS is a specific post type used to store CSS. If we add custom css on the customizer screen on additional CSS code, It will automatically create CPT. Only the active themes custom css post is actually used. Appearance -> Customize. While you create a new page, It stores a custom post type name as a “custom_css”

7. Templates

A WordPress theme can include different types of page templates. For example home, privacy policy and 404. Those are part of the template hierarchy and can be edited in the WordPress site editor. And also a page templates that are assigned to edited in the template editor. WordPress saves templates as a custom post type called as “wp_template”

There are 2 types we can create CPT in your website

For example, if you run an event website, then you would probably want to create a post type as the name of the “event” Moreover You could also create custom fields for event date, locations, and portfolios. The custom post type posts are gathered and stored in a separate section of the admin dashboard.

  • 1. Creating Custom Post Type Manually
  • 2. Creating a Custom Post Type with Plugin

1. Creating Custom Post Type Manually

Adding below the codes you can create custom post types in your website. Once you have register post type on your website to get the custom post type in Dashboard.

Add this code on your installed theme inside on your function.php

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

WordPress -CPT

2. Creating a Custom Post Type with Plugin

You can create custom post types with plugin in easy way, we have listed most popular CPT plugins in WordPres. 

  • 1. ACF
  • 2. Toolset
  • 3. Pods
  • 4. Meta Box
  • 5. CPT UI
  • 6. JetEngine

Import and Export Custom Post Types

We have an excellent plugin that supports all custom post types to import and export. Let’s try with our WordPress plugin to WP Ultimate CSV Importer. Our plugin has a fast solution to import and export all datas on your site. You can import any custom fields inside your site using WP Ultimate CSV Importer.

Related Blog Post How to Export and Import Advanced Custom Fields 

Wrapping Up!

Custom post types are quite good to know about all WordPress developers. We hope this article should help with creating custom posts on your website. If you are using any custom post type plugin,  We have a great solution with import and export data on your website. We have excellent import and export features for all custom post plugins. If you need any import and export solutions kindly contact us [email protected]

 

Cookies help us deliver our services. By using our services, you agree to our use of cookies.